题解 | #修补缺失的用户数据#
修补缺失的用户数据
https://www.nowcoder.com/practice/9863e81c8eba4c33817b26b801a17313
import pandas as pd Nowcoder = pd.read_csv('Nowcoder.csv', sep=',') pd.set_option('display.width', 300) # 设置字符显示宽度 pd.set_option('display.max_rows', None) # 设置显示最大行 pd.set_option('display.max_columns', None) year=Nowcoder['Graduate_year'] mean_achievement=round(Nowcoder['Achievement_value'].mean(),0) Nowcoder['Graduate_year'].fillna(value=year,inplace=True) Nowcoder['Language'].fillna(value='Python',inplace=True) Nowcoder['Achievement_value'].fillna(value=mean_achievement,inplace=True) print(Nowcoder)