I need to create a new data frame only using certain rows, which the value of a specific column meets a condition.
I have the following data frame (called: result):
source target weight
0 0 0.00
5 1 5.00
6 2 7.00
8 3 8.00
1 4 0.00
3 5 0.00
6 6 4.00
4 7 0.00
and I need to get something like this:
source target weight
5 1 5.00
6 2 7.00
8 3 8.00
6 6 4.00
However, I've been using the following procedures but they don't work and I'm getting the same result (first one) over and over.
result1 = result[result['weight'] > 0 ]
or
result1 = result.loc[result['weight'] > 0 ]
dtypes here? edit your question with the output fromdf.info()