Answers for "how to get certain columns from dataframe in python"

2

how to find columns of a dataframe

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

how to get only certain columns in pandas

#only the column names specified will be put into the new sub df
#enter a minimum of one column name
print(df[['column_name_1', 'column_name_2', ... , 'column_name_n']])
Posted by: Guest on March-15-2021

Code answers related to "how to get certain columns from dataframe in python"

Python Answers by Framework

Browse Popular Code Answers by Language