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

修补缺失的用户数据

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()

全部评论

相关推荐

想顺利毕业的猕猴桃在看牛客:好几个月没面试了,腾讯留面评吗
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客企业服务