Remove rows where at least one zero value

Question:

Here is my data frame

                          Param1                 Param2    datetime
ts                                                                            
1669246574000               6.06                  -1.80  22-24-11 01:36:14 UTC
1669242973000               6.50                  -1.73  22-24-11 00:36:13 UTC
...                          ...                    ...                    ...
1668918964000               6.00                   0.00  22-20-11 06:36:04 UTC
1668915364000               0.00                   1.6   22-20-11 05:36:04 UTC

Output with removed zero values

                          Param1                 Param2    datetime
ts                                                                            
1669246574000               6.06                  -1.80  22-24-11 01:36:14 UTC
1669242973000               6.50                  -1.73  22-24-11 00:36:13 UTC
Asked By: devaskim

||

Answers:

Try doing this:

df[(df != 0).all(1)]

or

df[df != 0].dropna()

Answered By: Paul
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.