Answers for "how to get columns from dataframe"

2

select columns from dataframe pandas

df = df.iloc[:,0:2] # this selects first two columns
df = df[['column1', 'column2']]
Posted by: Guest on January-22-2022
2

how to find columns of a dataframe

list(my_dataframe.columns.values)
Posted by: Guest on June-23-2020

Code answers related to "how to get columns from dataframe"

Python Answers by Framework

Browse Popular Code Answers by Language