0

I have a df with ID, Date, and DIM. DIM is int64

When I do:

df2=df.loc[df.DIM>50]

There are rows in df with DIM>50 that are not part of df2.

Does any one know why?

If I do :

df3=df.loc[df.ID==6]

It returns the rows with the ID that has DIM>57 and was not part of df2 above. Then, if I do:

df4=df3.loc[df3.DIM>50]

It works... Now, the rows originally excluded in df2 with DIM>50 are now in df3.

Himanshu Panwar
  • 216
  • 2
  • 7
user3446097
  • 21
  • 1
  • 1
  • 3
  • 2
    "*There are rows in df with DIM>50 that are not part of df2.*' -> please show us a reproducible example. Are you sure you have integers and not strings? – mozway Jun 12 '23 at 18:53
  • Kindly provide a snippet of your dataframe and expected output – Himanshu Panwar Jun 12 '23 at 18:54
  • Your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 Jun 12 '23 at 21:00
  • Can you provide us with outputs of `df.info()` and `df.isnull().sum()` ? – Mario Jun 15 '23 at 07:10

0 Answers0