0

I have tried in combination df2 = df.loc[['Entity'] != ('World')] df2.loc[['Code'].str.contains('',na=False)]

result from memory showing code NaN World removed

both have succeeded my needs the problem is combining them together. it seems to just not want to work. In one column titled 'Code' in the data the continents came with 'NaN' so I filtered that out using 'df.loc[['Code'].str.contains('',na=False)]' and it worked but then combined with "df2 = df.loc[['Entity'] != ('World')]" I apologise for wasting anyones time this is for an assessment and the thought of it is bugging me out. Did i do anything wrong or misread the purpose of a function?

Shinsui
  • 3
  • 2
  • Please, share your dataset and code https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples what does it mean "combining them together" please allow us to reproduce your results. – alec_djinn Jul 25 '22 at 11:00
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jul 25 '22 at 11:15

1 Answers1

0

To check your missing values you could use function isnull() or notnull() to filter, then correct them.

To remove and replace null values in Pandas DataFrame You could use ‘fillna()’. This is commonly replaced with 0 but depends on your DataFrame.

live405
  • 26
  • 2