I have in my data set column activity which contains numbers from 1 to 7, but there is a line with a zero in this column
using inst data['activity'].value_counts() I got
7 83748
1 33676
4 26860
3 11179
5 3191
6 2917
2 928
0 1
Name: activity, dtype: int64
so I want to delete the entire line to have result like:
7 83748
1 33676
4 26860
3 11179
5 3191
6 2917
2 928
Name: activity, dtype: int64
CodePudding user response:
Without any more information than what you have provided, I think you can use the DataFrame.drop method as follows:
df.drop(axis=0, index=0, inplace=True)¶
CodePudding user response:
You can use this:
data = data.drop(data[data.activity == 0].index)
CodePudding user response:
You can do data = data.loc[data['activity'] != 0]
