I have a csv file with the following:
storeNumber, sale1, sale2
1, 1, 1
2, 0, 0
3, 1, 0
4, 0, 1
...
25, 0, 0
26, 1, 0
27, 0, 1
28, 0,0
I need to delete rows with sale1 and sale2 that are equal to 0.
I have the following code setup:
import pandas as pd
df = pd.read_csv('sales.csv', index_col=0)
df_new = df[df.sale1 != 0] and df[df.sale2 != 0]
print(df_new)
the code works if I will only delete one of each column that has 0 value.
df_new = df[df.sale1 != 0]
or
df_new = df[df.sale2 != 0]
However, when put the code above with the "and", I get an error that says:
ValueError: The truth value of a DataFrame is ambiguous. Use a.empty, a.bool(), a.item(), a.any() or a.all().
what is the right code for deleting rows that have 0 value for both sale1 and sale2?