Answers for "filter df for column value "starts" with pattern"

0

filter df for column value "starts" with pattern

#filter df for column value "starts" with pattern

# importing pandas module  
import pandas as pd 
  
# reading csv file from url  
data = pd.read_csv("https://media.geeksforgeeks.org/wp-content/uploads/nba.csv") 
  
# String to be searched in start of string  
search ="G"
  
# boolean series returned with False at place of NaN 
bool_series = data["College"].str.startswith(search, na = False) 
  
# displaying filtered dataframe 
data[bool_series]
Posted by: Guest on December-01-2020

Python Answers by Framework

Browse Popular Code Answers by Language