pandas df get column names code example
Example 1: python return column names of pandas dataframe
your_dataframe.columns
list(your_dataframe.columns)
Example 2: pd dataframe get column names
lst = data.columns.values
Example 3: how to find columns of a dataframe
list(my_dataframe.columns.values)
Example 4: python select columns names from dataframe
import pandas as pd
data = pd.read_csv("nba.csv")
for col in data.columns:
print(col)
Example 5: pandas dataframe column names
print(data.columns.values)
Example 6: dataframe names pandas
print(df.rename(columns={'A': 'a', 'C': 'c'}))