
pandas
点PY
付费咨询、有偿辅导+扣扣1224425503
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
利用pandas删除满足条件的行
要解决的问题data = pd.read_csv("train.csv")for i in range(80, 102, 2): perc = np.percentile(data['area'], i) print(f"{i} percentile of area is {perc}")某行的面积值过大,需要删除。解决过程rows = [x for x in data.index if data.loc[x]['area']>256*256]data2 = dat原创 2020-05-11 20:22:32 · 8291 阅读 · 0 评论 -
pandas中loc和iloc的区别
对于一个DataFrame A,A.loc[k]是读取A中index为k的那一行。A.iloc[k]是读取A中的第k行。假设下面的DataFrame叫AAName Age1 Tom 203 Tony 194 Jim 22>>> A.loc[3]Tony 19>>>A.ilo...原创 2020-03-18 18:00:40 · 368 阅读 · 0 评论