这是非常简单的代码,我不确定导致破损的原因。
我的代码是:
import pandas as pd
import matplotlib
Location = 'r/home/michael/PycharmProjects/cmsDataProject/inpatientProviderPaymentSummary.csv'
df = pd.read_csv(Location, header=False)
print df.info()
当我在Pycharm控制台中运行它时,我得到:
/usr/bin/python2.7 /home/michael/PycharmProjects/cmsDataProject/IngestCSV.py
<class 'pandas.core.frame.DataFrame'>
Int64Index: 163065 entries, 0 to 163064
Data columns (total 12 columns):
DRG Definition 163065 non-null object
Provider Id 163065 non-null int64
Provider Name 163065 non-null object
Provider Street Address 163065 non-null object
Provider City 163065 non-null object
Provider State 163065 non-null object
Provider Zip Code 163065 non-null int64
Hospital Referral Region Description 163065 non-null object
Total Discharges 163065 non-null int64
Average Covered Charges 163065 non-null object
Average Total Payments 163065 non-null object
Average Medicare Payments 163065 non-null object
dtypes: int64(3), object(9)
memory usage: 16.2+ MB
None
Process finished with exit code 0
我应该得到哪个输出。
当我使用/cmsDataProject/>python IngestCSV.py
运行相同的代码时,我得到:
File "IngestCSV.py", line 9
print df.info()
^
SyntaxError: invalid syntax
是什么给出的?他们可以以某种方式使用不同版本的解释器吗?
答案 0 :(得分:1)
您的默认>python
可能正在调用Python 3,这需要print
的括号。 Pycharm表明它使用Python 2.7。请改为print(df.info())
。