so, i have csv files like image above, which i want create filter :if 'Bids'< 3 AND 'Price'> 149
then data should be deleted, like the image above, data number 2 should be deleted
i already try this approach but didnt get what i want,
def filter(csv_file, csv2_file): df = pd.read_csv(csv_file, header=0, index_col=False) #Convert 'Bid' and 'Price' columns to numeric type df['Bids'] = pd.to_numeric(df['Bids'], errors='coerce') df['Price'] = pd.to_numeric(df['Price'], errors='coerce') # Apply filtering conditions filtered_df = df[(df['Bids'] < 3) & (df['Price'] > 149)] filtered_df.to_csv(csv2_file, index=False)
as the result, the new output csv file is removing all the data,
please review my code