I am trying to code a simple recommender system using only pandas and I am having trouble with the filtering part.I want to select all the rows where the RatingCounts column is greater than a value I choose.This returns me a dataframe with one column filled with the correct booleans but i cannot index my data with this selection it gives me a value error as mentioned in the title.Here is the screenshot
selection
appears to be a 2D DataFrame with 1 column, RatingCounts
.
The error occurs when you pass a 2D indexer to DataFrame.loc
.
You can avoid the error by passing a 1D boolean indexer to DataFrame.loc
:
final_data.loc[selection['RatingCounts']]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With