Skip to content
Advertisement

Dropping rows and finding the average of a speific column

I am trying to remove specific rows from the dataset and find the average of a specific column after the rows are removed without changing the original dataset

import pandas as PD
import NumPy as np
df = PD.read_csv(r"C:UsersUserDownloadsnba.CSV")
NBA = PD.read_csv(r"C:UsersUserDownloadsnba.CSV")
NBA.drop([25,72,63],axis=0)

I NEED TO FIND THE AVERAGE OF A SPECIFIC COLUMN LIKE "AGE" 

HOWEVER THIS ISNT WORKING: Nba.drop([25,72,63],axis=0),['Age'].mean() 
NEITHER IS THE QUERY COMMAND OR THE. LOC COMMAND

Advertisement

Answer

can you try this? I think there was a typo in your code

Nba.drop([25,72,63],axis=0)['Age'].mean() 
User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement