I'm trying to retrieve the column names of a dataframe, all in lower case, but that's giving me the following Attribute Error: 'DataFrame' object has no attribute 'column'.
import pandas as pd
df = pd.read_csv('C:/dataset.csv')
col_names=df.column.values.lower()
print(col_names)
Why is this error showing up & how do I fix it?
CodePudding user response:
IIUC, replace "column" by "columns" and use the str.lower
accessor:
col_names = df.columns.str.lower().tolist()