python dataframe 统计

今天在用dataframe用到的方法

  • 1.取某列某个范围内的数据
    data_total = data_total[(data_total['inTime'] > np.datetime64(date_begin)) & (data_total['inTime'] < np.datetime64(date_end))]
  • 2.按某列统计数据
   dh = dh['enterprise_id'].sum()
   dh = dh['enterprise_id'].count()
  • 3.遍历dataframe
    for index,item in pd.iterrows():
  • 4.时间截取年与日
for index,item in pd.iterrows():
        date = item[9].date()
    原文作者:志明S
    原文地址: https://www.jianshu.com/p/979516df0f41
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞