floor = row['floor']
total = row['floors_total']
try:
if floor == 1:
return '??????'
if floor == unemployed:
return '?????????'
return '??????'
except:
return '??? ?????????'
df['floor_type'] = df['floor'].
df['floor_type'].unique()
TypeError Traceback (most recent call last)
/tmp/ipykernel_228/3077829014.py in <module>
----> 1 df['floor_type'] = df['floor'].apply(categorize_floor).astype({'floor_type':str})
2 df['floor_type'].unique()
/opt/conda/lib/python3.9/site-packages/pandas/core/series.py in apply(self, func, convert_dtype, args, **kwds)
4136 else:
4137 values = self.astype(object)._values
-> 4138 mapped = lib.map_infer(values, f, convert=convert_dtype)
4139
4140 if
pandas/_libs/lib.pyx in pandas._libs.lib.map_infer()
/tmp/ipykernel_228/2479482430.py in categorize_floor(row)
1 def categorize_floor(row):
----> 2 floor = row['floor']
3 total = row['floors_total']
4 try:
5 if
TypeError: 'int' object is not subscriptable