alex_bn_lee

导航

2023年7月20日 #

【864】pandas dataframe根据规则批量赋值

摘要: ref: Pandas新增一列并按条件赋值? 把下图中的 NaN 都赋值为 0 df.loc[条件判断, 'value'] = 0 m = pd.merge(gdf_africa, df_af_mp, how='left', on='country') m.loc[m['value'].isna() 阅读全文

posted @ 2023-07-20 14:10 McDelfino 阅读(261) 评论(0) 推荐(0)

【863】Calculate records based on the same value

摘要: Suppose we have a dataframe, it has a column of "country". It lists different names of country's names, and for one country maybe it has multiple reco 阅读全文

posted @ 2023-07-20 13:33 McDelfino 阅读(12) 评论(0) 推荐(0)

【862】as.Date in R programming

摘要: ref: R语言——日期时间处理 ref: as.Date: Date Conversion Functions to and from Character ref: Date Formats in R as.Date()it can change a normal string into a da 阅读全文

posted @ 2023-07-20 12:38 McDelfino 阅读(19) 评论(0) 推荐(0)