DataFrame.replace不';我不在一个领域工作
我有这个df:DataFrame.replace不';我不在一个领域工作,dataframe,replace,Dataframe,Replace,我有这个df: Data columns (total 5 columns): Gender 23999 non-null object Civilstat 23999 non-null object Job 23999 non-null object Sector 23999 non-null object Phone 23999 non-null object dtypes: object(5) 然
Data columns (total 5 columns):
Gender 23999 non-null object
Civilstat 23999 non-null object
Job 23999 non-null object
Sector 23999 non-null object
Phone 23999 non-null object
dtypes: object(5)
然后我使用:
cleanup_cats = {"Gender": {'M': 1, 'F': 2, '0': 0 },
"Civilstat": {"Married": 0, "Single": 1 },
"Sector": {"Private": 0, "Public": 1, "Unemp": 2, "Selfemployed": 3 }
}
及
所有作品都很好,但“自营”…我收到了:
0 11564
1 9515
2 2210
Selfemployed 710
Name: Sector, dtype: int64
我不知道发生了什么,你能给我一些想法吗,先谢谢你
0 11564
1 9515
2 2210
Selfemployed 710
Name: Sector, dtype: int64