【问题标题】:How do i write a program that helps me calculate the total no. of accidents in the years specificallyHow do i write a program that helps me calculate the total no. of accidents in the years specifically
【发布时间】:2022-12-02 10:44:39
【问题描述】:

I am using anaconda python and using the tabulate table. I am able to consodilate the follow data. My cvs file looks something like this:

`year,accident_classification,road_user_group,causes_of_accident,number_of_accidents 2012,FATAL,Drivers or Riders or Cyclists,Failing to Keep a Proper Lookout,59 2012,FATAL,Drivers or Riders or Cyclists,Failing to Have Proper Control,50 2012,FATAL,Drivers or Riders or Cyclists,Failing to Give Way to Traffic with Right of Way,9 2012,FATAL,Drivers or Riders or Cyclists,Changing Lane without Due Care,6 2013,FATAL,Drivers or Riders or Cyclists,Failing to Keep a Proper Lookout,53 2013,FATAL,Drivers or Riders or Cyclists,Failing to Have Proper Control,38 2013,FATAL,Drivers or Riders or Cyclists,Failing to Give Way to Traffic with Right of Way,15 2013,FATAL,Drivers or Riders or Cyclists,Changing Lane without Due Care,7 2013,FATAL,Drivers or Riders or Cyclists,Disobeying Traffic Light Signals Resulting in Accidents with Vehicle,5 2013,FATAL,Drivers or Riders or Cyclists,Turning Without Due Care,8

I would like the output to look something like this: Total number of accidents in 2012: <> Total number of accidents in 2013: <> Total number of accidents in 2014: <>`

    标签: python numpy csv anaconda tabulate


    【解决方案1】:

    Are you referring to the tabulate python library? https://pypi.org/project/tabulate/

      猜你喜欢
      • 2022-12-02
      • 2022-12-02
      • 2022-12-27
      • 2022-12-27
      • 2022-12-02
      • 2022-12-02
      • 2022-12-01
      • 2018-12-10
      • 2022-12-02
      相关资源
      最近更新 更多