get columns of dataframe code example
Example 1: get column number in dataframe pandas
# PANDAS: get column number from colomn name
dataframe.columns.get_loc("")
Example 2: pd dataframe get column names
lst = data.columns.values # data is dataframe
Example 3: how to find columns of a dataframe
list(my_dataframe.columns.values)
Example 4: get column pandas
column = df["column_name"]
Example 5: print columns pandas
df = pd.DataFrame(exam_data , index=labels)
# print the columns labeled "name" and "score"
print(df[['name', 'score']])