【发布时间】:2018-01-22 09:43:44
【问题描述】:
大家好
我希望得到您的帮助。 所以我想使用客户收入代理创建一个名为 df['Income_Status'] 的新列。
Where
1 = High Avg Income,
2 = Med Avg Income,
3= Low Avg Income
这是我的数据集的样子:
Customer_id Income_Proxy Average_Income_Proxy Standard_dev_Income_Proxy
123 7681559.15 44288.02 176568.76
456 15156.29 44288.02 176568.76
789 50497.69 44288.02 176568.76
096 44138.41 44288.02 176568.76
158 67866.45 44288.02 176568.76
The condition is:
IF INCOME_PROXY <= MEAN_INCOME_PROXY - (0.5)*&STD_INCOME_PROXY
then High Avg Income
IF INCOME_PROXY >= MEAN_INCOME_PROXY + (0.5)*STD_INCOME_PROXY
then Low Avg Income
else Low Avg Income
如何使用所提供的条件创建一个列来为我提供收入状态。 我将如何用 Pandas python 格式编写这个条件?
【问题讨论】:
-
问题似乎是错误的,
then Low Avg Income else Low Avg Income
标签: python python-3.x python-2.7 pandas