Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python | Pandas DataFrame.where()

# importing pandas package
import pandas as pd
  
# making data frame from csv file
data = pd.read_csv("cff.csv")
  
# sorting dataframe
data.sort_values("Team", inplace = True)
  
# making boolean series for a team name
filter = data["Team"]=="cff"
  
# filtering data
data.where(filter, inplace = True)
  
# display
data
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #Python #Pandas
ADD COMMENT
Topic
Name
4+3 =