Uda*_*nta 5 python regex dataframe pandas
假设我使用国家名称作为行索引的python中的熊猫将人口数据存储在数据框的列中。如何使用逗号将整列数字转换为字符串千位分隔符。基本上,我需要12345678,integer,转换为12,345,678。
Zer*_*ero 5
使用apply格式化的数字。
apply
In [40]: ps.apply('{:,}'.format) Out[40]: CountryA 12,345,678 CountryB 3,242,342 dtype: object In [41]: ps Out[41]: CountryA 12345678 CountryB 3242342 dtype: int64
归档时间:
8 年,11 月 前
查看次数:
1886 次
最近记录: