python - 'DataFrame' object has no attribute 'col_name' -
i read csv file using
x = pd.read_table('path csv')
and can see row-wise comma-separated list of data values on printing x fine. when try access column using x.col1, gives error :
**attributeerror: 'dataframe' object has no attribute 'col1'**
i tried doing :
y = dataframe(x)
and retrieve column via y no luck. however, command x.columns works. can't figure problem here.
please help!!
i think read_table
have default separator tab, necessary define separator parameter:
x = pd.read_table('path csv', sep=',')
or use read_csv
default separator ,
, sep
: can omit.
x = pd.read_csv('path csv')
Comments
Post a Comment