1

Having a pivot as below:

img12

I was trying to drop the NaN values:

matrix = matrix.drop(index=None, columns=None)

Its not working.

ValueError: Need to specify at least one of 'labels', 'index' or 'columns'

Is there any other way to do this? Expected output:

img3

  • 1
    if you dont provide labels,index or column name how it can drop? use `dropna` instead of `drop` – Mehmaam Oct 21 '22 at 08:37

1 Answers1

0

drop is for dropping entire rows or columns (independed of their values). Use dropna to delete rows or columns where values are NAN

tturbo
  • 680
  • 5
  • 16