I am new coding in Python and I'm facing an issue.
I've a pandas dataframe like this:
df = pd.DataFrame({'color':['red', 'green', 'blue'], 'brand':['Ford','fiat', 'opel'], 'year':[2016,2016,2017]})
Which I want to filter by a dictionary like this:
d = {'color':'red', 'year':2016}
I can filter using this:
df.loc[np.all(df[list(d)] == pd.Series(d), axis=1)]
But when I try to put this last statement on a function, it doesn't work anymore and I get "none" as result. Anyone knows where are my mistakes?
my code:
