Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

pandas get columns in list

df[df[_col_name_].isin([_list_of_names_])]
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

dataframe column in list

In [1]: df = pd.DataFrame({'A': [5,6,3,4], 'B': [1,2,3,5]})

In [2]: df
Out[2]:
   A  B
0  5  1
1  6  2
2  3  3
3  4  5

In [3]: df[df['A'].isin([3, 6])]
Out[3]:
   A  B
1  6  2
2  3  3
Comment

get dataframe column into a list

df_gearME = pd.read_excel('Gear M&Es.xlsx')
df_gearME['ColA'].to_list()
Comment

PREVIOUS NEXT
Code Example
Python :: fast fourier transform python 
Python :: python package version in cmd 
Python :: how to convert decimal to binary python 
Python :: python code to generate fibonacci series 
Python :: flask quickstart 
Python :: list comprehension if 
Python :: list of seaborn color palette 
Python :: python subprocess print stdout while process running 
Python :: python find the average of a list 
Python :: python regular expression remove numbers 
Python :: get month day year 12 hour time format python 
Python :: how to convert a set to a list in python 
Python :: pandas sep 
Python :: render django 
Python :: root mean squared error 
Python :: when button is clicked tkinter python 
Python :: first column of a dataframe python 
Python :: python using datetime as id 
Python :: python if in list multiple 
Python :: django dockerfile multistage 
Python :: python scraping 
Python :: python - change the bin size of an histogram+ 
Python :: Pandas categorical dtypes 
Python :: Randint Random Library 
Python :: python sort columns of pandas dataframe 
Python :: add x=y line to scatter plot python 
Python :: pandas select rows by multiple conditions 
Python :: append dataframe pandas 
Python :: python challenges 
Python :: python how to calculate how much time code takes 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =