首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往
您找到你想要的搜索结果了吗?
是的
没有找到

Pandas进阶修炼120题|第一期

难度:⭐⭐ 答案 df['grammer'].value_counts() 6 缺失值处理 题目:将空值用上下值的平均值填充 难度:⭐⭐⭐ 答案 df['popularity'] = df['popularity...'].fillna(df['popularity'].interpolate()) 7 数据提取 题目:提取popularity列中值大于3的行 难度:⭐⭐ 答案 df[df['popularity']...列值大于3小于7的行 难度:⭐⭐ 答案 df[(df['popularity'] > 3) & (df['popularity'] < 7)] 14 位置处理 题目:交换两列位置 难度:⭐⭐⭐ 答案 temp...= df['popularity'] df.drop(labels=['popularity'], axis=1,inplace = True) df.insert(0, 'popularity',...temp) 15 数据提取 题目:提取popularity列最大值所在行 难度:⭐⭐ 答案 df[df['popularity'] == df['popularity'].max()] 16 数据查看

70910

玩转数据处理120题|R语言版本

# 神方法table table(df$grammer) 6 缺失值处理 题目:将空值用上下值的平均值填充 难度:⭐⭐⭐ 上下两数的均值 df['popularity'] = df['popularity...'].fillna(df['popularity'].interpolate()) R语言解法 library(Hmisc) index <- which(is.na(df$popularity)) df...df[index+1, 2]))/2) 7 数据提取 题目:提取popularity列中值大于3的行 难度:⭐⭐ R语言解法 df %>% filter(popularity > 3) # 等价于...列值大于3小于7的行 难度:⭐⭐ R解法 library(dplyr) df %>% filter(popularity > 3 & popularity <7) # 等价于 df[(df$popularity...()) 15 数据提取 题目:提取popularity列最大值所在行 难度:⭐⭐ R解法 df %>% filter(popularity == max(popularity)) # 同理也有类似pandas

8.7K10
领券