0
我正在使用canopy v1.4.1的免費版本。我也有類似的問題,在這裏說:http://stackoverflow.com/questions/11361985/output-data-from-all-columns-in-a-dataframe-in-pandas
而是獲得關於數據幀我得到實際的表,在表中列出的數據信息:如何顯示天篷數據框的信息
,我希望它看起來像:
In [373]: names
Out[373]:
<class 'pandas.core.frame.DataFrame'>
Int64Index: 1690784 entries, 0 to 1690783
Data columns:
name 1690784 non-null values
sex 1690784 non-null values
births 1690784 non-null values
year 1690784 non-null values
dtypes: int64(2), object(2)
我的代碼:
pandas as pd
pieces = [] # create the dictionary for the names
columns = ['name', 'sex', 'births'] # specify the columns names
for year in years:
path = 'yob%d.txt' % year
frame = pd.read_csv(path, names = columns)
frame['year'] = year
pieces.append(frame)
names = pd.concat(pieces, ignore_index = True)
print names