how to choose columns in pandas code example
Example 1: python: select specific columns in a data frame
df = df[["Column_Name1", "Column_Name2"]]
Example 2: python select columns names from dataframe
import pandas as pd
data = pd.read_csv("nba.csv")
for col in data.columns:
print(col)
Example 3: select columns to include in new dataframe in python
new = old[['A', 'C', 'D']].copy()
Example 4: select columns to include in new dataframe in python
new = old.filter(['A','B','D'], axis=1)
Example 5: selecting items in a column of a dataframe
df.loc[df['column_name'] == some_value]