I would like to create a new column in pandas based on the ranges of another column values. I have tried some things but haven't managed it yet. Let's say that i have a column 'gdp' and i want to make a new column with classifications based on some ranges of 'gdp'. Rows with gdp below 1000 should be classified as low Rows with gdp between 1000-2000 should be classified as medium and so on.
dff['class'] = dff[(dff['gdp'] <= 1000 == 'Low') & ((dff['gdp'] >= 1000 )\
&(dff['gdp'] <= 2000 ) == 'Medium') & ((dff['gdp'] > 2001 ) == 'High')]