0 points

Pandas data frame filter column names regex


dashboard

Sat Oct 31 2020 00:38:58 GMT+0000 (UTC)

Posted by @ianh #pandas #filter

# importing pandas as pd 
import pandas as pd 
  
# Creating the dataframe  
df = pd.read_csv("nba.csv") 
  
# Using regular expression to extract all 
# columns which has letter 'a' or 'A' in its name. 
df.filter(regex ='[aA]') 
content_copy Copy

https://www.geeksforgeeks.org/python-pandas-dataframe-filter/