qq_27866857
qq_27866857
2021-01-19 18:33

python dataframe既有文字又有数字,所有数字列都/100.

  • python
  • 开发语言

 python dataframe既有文字又有数字,列数很多,对数字进行处理,比如最后一列/100,或者所有数字列都/100.

import pandas as pd
d={
    'name':['a','n','c','d','e','f'],
    # 'Gender':['male','female','male','male','female','female'],
    'age':[23,24,24,22,21,20],
    'hight':[173,174,164,172,161,160],
    'weight1':[53,74,44,62,71,60],
    'weight2':[53,64,54,66,81,50]
}
df=pd.DataFrame(d)
df.set_index('name')
print(df)
  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

2条回答

为你推荐