pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
# Basic syntax:
your_dataframe.columns
# Note, if you want the column names as a list, just do:
list(your_dataframe.columns)
starts_with_foo = [col for col in df if col.startswith('foo')]
lst = data.columns.values # data is dataframe
# Import pandas package
import pandas as pd
# making data frame
data = pd.read_csv("nba.csv")
# iterating the columns
for col in data.columns:
print(col)
pd.options.display.max_columns = None
pd.options.display.max_rows = None
print(dataframe.columns)
import pandas as pd
df = pd.read_csv("file path.csv")
df.columns
list(my_dataframe)
import pandas as pd
# Dataframe example
df = pd.DataFrame({'col_A':[1,5,7,8],'col_B':[9,7,4,3], 'col_C':[5,1,4,9]})
# Showing all column names and indexes for df
print(* (f"{i}: {col}" for i,col in enumerate(df.columns)), sep='
')