Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

get list of column names pandas

col_names = list(df.columns)
Comment

list columns in pandas df

# Import pandas package 
import pandas as pd 
    
# making data frame 
data = pd.read_csv("nba.csv") 
    
# list(data) or
list(data.columns)
Comment

python list all columns in dataframe

list(my_dataframe)
Comment

select list of columns pandas

df[['C', 'D', 'E']]  # or df.loc[:, ['C', 'D', 'E']]
Comment

PREVIOUS NEXT
Code Example
Python :: python print every character in list as string 
Python :: Static Language Programmers 
Python :: add favicon in django admin 
Python :: pandas dataframe convert yes no to 0 1 
Python :: why pytest return No ModuleError 
Python :: Python basic discord bot 
Python :: Adding new column to existing DataFrame in Pandas using assign method 
Python :: pandas difference between two dataframes 
Python :: df.loc a list of index 
Python :: pandas check if column is object type 
Python :: lemmatization in nlp 
Python :: pandas describe 
Python :: dict to tuple 
Python :: glob.glob python 
Python :: long in python 
Python :: destructuring for dict in python 
Python :: how to get a row of a dataframe with subset columns in python 
Python :: how to make a loop in python 
Python :: How to get historical klines python binance 
Python :: steps in for loop python 
Python :: pandas disply options 
Python :: sns boxplot ylabelsize 
Python :: does tuple allow duplicate values in python 
Python :: dont truncate dataframe jupyter pd display options 
Python :: pygame moving shape 
Python :: combine column in csv python pandas 
Python :: get all functions from a module as string list python 
Python :: convert PIL RGB to opencv BRG 
Python :: python os 
Python :: Python NumPy squeeze function Example 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =