Reputation: 71
I tried to create a function that reads my file and the column I want it to read:
def read_row(file, column):
main_df = np.array([])
for df in pd.read_csv(file, chunksize = 100000):
column_name = df.column.unique()
main_df = np.append(main_df,column_name)
return(main_df)
However it shows AttributeError: 'DataFrame' object has no attribute 'column'
.
What should I put instead of column in df.column.unique()
?
Upvotes: 2
Views: 51
Reputation: 862431
Use brackets []
instead dot notation:
column_name = df[column].unique()
Upvotes: 1