Hailey
0
Q:

find a string in a dataframe

# 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") 
   
# dropping null value columns to avoid errors 
data.dropna(inplace = True) 
  
# substring to be searched 
sub ='a'
  
# creating and passsing series to new column 
data["Indexes"]= data["Name"].str.find(sub) 
  
# display 
data 
1

New to Communities?

Join the community