0

I have a function like this:

def cal_info(data):
    if 0 <= data <= 600:
        return '1'
    elif 1000 <= data <= 2200:
        return '3'
    elif 2200 <= data <= 3500:
        return '7'
    elif 3500 <= data <= 7000:
        return '20'
    else:
        return 'None'

And I column in df with values from 0 to 7000.

And then I need to map this function to that column to get another column:

df = final_df.assign(new_col=map(cal_info, df['column1']))

But I'm getting this:

<map object at 0x7f8db8d63160>
jovicbg
  • 1,523
  • 8
  • 34
  • 74

0 Answers0