题解 | #修补缺失的用户数据#

修补缺失的用户数据

https://www.nowcoder.com/practice/9863e81c8eba4c33817b26b801a17313

import pandas as pd


data = pd.read_csv("Nowcoder.csv", sep=",")

pd.set_option("display.max_columns", None)
pd.set_option("display.max_rows", None)

pd.set_option("display.width", 300)
# 这里我们又要使用来填补咯 fillna

if data["Language"] is None:
    data["Language"] == "Python"

fillmax = data["Graduate_year"].max()

if data["Graduate_year"] is None:
    data["Graduate_year"] = fillmax

avg = int(data["Achievement_value"].mean().round())

if data["Achievement_value"] is None:
    data["Achievement_value"] = avg

print(data)

我没有使用pandas的函数fillna()

全部评论

相关推荐

不愿透露姓名的神秘牛友
05-28 12:15
点赞 评论 收藏
分享
每晚夜里独自颤抖:你cet6就cet6,cet4就cet4,你写个cet证书等是什么意思。专业技能快赶上项目行数,你做的这2个项目哪里能提现你有这么多技能呢
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务