-1

I have some data like the following data.

0   11.0
1   7.5
2   6.1
3   11.4
4   0.0
5   0.0
6   0.0
7   0.0
8   26.5
9   0.0
10  4.1
11  0.5
12  1.0
13  11.0
14  26.8
15  9.2
16  1.9
17  9.1
18  0.9
19  1.1
20  0.0
21  0.6
22  0.0
23  2.0
24  18.2
25  0.0
26  0.5
27  15.9
28  10.9
29  0.9
30  0.0
31  0.0
32  9.2
33  0.0
34  0.0
35  0.0
36  5.5
37  0.0
38  0.0
39  0.5

I want to remove zero numbers from this data frame. Of course, in other data, the rows or the number of zeros in the data frame may be different. I wrote this code but it gives an error: (IndentationError: expected an indented block):

for i in range(0 , len(csvfile[0])-1):
    if csvfile[i]==0:
    csvfile.drop([i], axis=[0], inplace=True)

thank you

Honn
  • 737
  • 2
  • 18
farhad
  • 1
  • 1

1 Answers1

1

Correct indentation:

for i in range(0 , len(csvfile[0])-1):
    if csvfile[i]==0:
        csvfile.drop([i], axis=[0], inplace=True)