Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Show column names and indexes dataframe python

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='
')
Source by www.codegrepper.com #
 
PREVIOUS NEXT
Tagged: #Show #column #names #indexes #dataframe #python
ADD COMMENT
Topic
Name
4+1 =