1

I have a data frame with 2Lakh records, one of the numeric column(Volume) contains the strings. Would like to access those rows and replace with most frequent value.

I tried below but getting an error.

df[df["Volume"].dtype!=np.int64]

KeyError: True

During handling of the above exception, another exception occurred:

Optimizer
  • 87
  • 2
  • 10
  • Don't use "Lakh". This a word used in South Asian countries to denote 100 thousand. Stackoverflow is a international community so if you want people to respond you should use more general terms. – Indy Jul 29 '20 at 14:07

1 Answers1

0

Your example code evaluates to

df[(CONDITIONAL)]

So you end up trying to get the key/index "True" of df. If you wrote it as:

df["Volume"].dtype!=np.int64

Then you should be better off.

joedeandev
  • 626
  • 1
  • 6
  • 15