diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 415688f..f543590 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -33,7 +33,7 @@ jobs:
- name: Test run
run: |
stravavis --help
- stravavis tests/gpx
+ stravavis tests/gpx --activities_path tests/csv
- name: Upload output images
uses: actions/upload-artifact@v3
diff --git a/setup.cfg b/setup.cfg
index c8a9a86..3674149 100644
--- a/setup.cfg
+++ b/setup.cfg
@@ -37,7 +37,8 @@ install_requires =
fit2gpx
gpxpy
matplotlib
- pandas
+ # Pending https://github.com/MarvinT/calmap/pull/14
+ pandas<2
plotnine
rich
seaborn
diff --git a/src/stravavis/plot_calendar.py b/src/stravavis/plot_calendar.py
index 2db54b0..22324ca 100644
--- a/src/stravavis/plot_calendar.py
+++ b/src/stravavis/plot_calendar.py
@@ -2,13 +2,18 @@
import matplotlib.pyplot as plt
import pandas as pd
+
+ACTIVITY_FORMAT = "%b %d, %Y, %H:%M:%S %p"
+
def plot_calendar(activities, year_min=None, year_max=None, max_dist=None,
fig_height = 15, fig_width = 9, output_file='calendar.png'):
# Create a new figure
plt.figure()
# Process data
- activities['Activity Date'] = pd.to_datetime(activities['Activity Date'])
+ activities["Activity Date"] = pd.to_datetime(
+ activities["Activity Date"], format=ACTIVITY_FORMAT
+ )
activities['date'] = activities['Activity Date'].dt.date
activities = activities.groupby(['date'])['Distance'].sum()
activities.index = pd.to_datetime(activities.index)
diff --git a/tests/csv/activities.csv b/tests/csv/activities.csv
new file mode 100644
index 0000000..7b8739b
--- /dev/null
+++ b/tests/csv/activities.csv
@@ -0,0 +1,9 @@
+Activity ID,Activity Date,Activity Name,Activity Type,Activity Description,Elapsed Time,Distance,Max Heart Rate,Relative Effort,Commute,Activity Private Note,Activity Gear,Filename,Athlete Weight,Bike Weight,Elapsed Time,Moving Time,Distance,Max Speed,Average Speed,Elevation Gain,Elevation Loss,Elevation Low,Elevation High,Max Grade,Average Grade,Average Positive Grade,Average Negative Grade,Max Cadence,Average Cadence,Max Heart Rate,Average Heart Rate,Max Watts,Average Watts,Calories,Max Temperature,Average Temperature,Relative Effort,Total Work,Number of Runs,Uphill Time,Downhill Time,Other Time,Perceived Exertion,"Type","Start Time",Weighted Average Power,Power Count,Prefer Perceived Exertion,Perceived Relative Effort,Commute,Total Weight Lifted,From Upload,Grade Adjusted Distance,Weather Observation Time,Weather Condition,Weather Temperature,Apparent Temperature,Dewpoint,Humidity,Weather Pressure,Wind Speed,Wind Gust,Wind Bearing,Precipitation Intensity,Sunrise Time,Sunset Time,Moon Phase,Bike,Gear,Precipitation Probability,Precipitation Type,Cloud Cover,Weather Visibility,UV Index,Weather Ozone,"Jump Count","Total Grit","Avg Flow","Flagged","Avg Elapsed Speed","Dirt Distance","Newly Explored Distance","Newly Explored Dirt Distance","Sport Type","Total Steps",Media
+9125662739,"May 23, 2023, 12:40:57 PM",Evening Ride,Ride,,6124,33.91,,,false,,TCR ADV 3,,,,6124,5103,33912.48046875,28.0181102752686,6.64559698104858,124,126,-20,58,44.4619865417481,0.002948766807094,,,,0,,0,,87.1724853515625,683,,21,,,,,,,6,,,,,0,134,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,5.53763580322266,1318.80004882813,,,,,
+9148958024,"May 27, 2023, 1:24:16 AM",Morning Ride,Ride,,31872,122.67,,,false,,TCR ADV 3,,,,31872,19143,122675.9921875,12.3882808685303,6.40839958190918,373,357,-7,108,46.9055366516113,0.005706088151783,,,,0,,0,,117.04443359375,2562,,33,,,,,,,8,,,,,0,824,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,3.84902095794678,0,,,,,
+9189096048,"Jun 2, 2023, 11:48:52 AM",Evening Ride,Ride,,14194,51.83,,,false,,TCR ADV 3,,,,14194,8405,51837.44921875,12.9382810592651,6.16745376586914,393,399,10,190,49.4113121032715,0.023149287328124,,,,0,,0,,126.669448852539,1079,,26,,,,,,,9,,,,,0,420,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,3.6520676612854,0,,,,,
+9233077380,"Jun 9, 2023, 1:02:03 PM",Night Ride,Ride,,5280,32.84,,,false,,TCR ADV 3,,,,5280,4862,32848.51171875,10.8902339935303,6.75617265701294,132,134,12,79,36.616626739502,0.015221389941871,,,,0,,0,,129.770172119141,649,,29,,,,,,,7,,,,,0,155,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,6.22130918502808,0,,,,,
+9233439372,"Jun 9, 2023, 1:02:03 PM",Evening Ride,Ride,,5280,32.84,,,false,,TCR ADV 3,,,8,5280,4862,32848.51171875,10.8902339935303,6.75617265701294,132,134,12,79,36.616626739502,0.015221389941871,,,,0,,0,,129.728652954102,649,,29,,,,,,,,,,,,,,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,6.22130918502808,0,,,,,
+9239384321,"Jun 10, 2023, 10:36:58 AM",Evening Ride,Ride,,14142,67.2,,,false,,TCR ADV 3,,,8,14142,10121,67206.78125,10.5140628814697,6.64033031463623,219,238,-20,60,48.9795913696289,-0.002975890180096,,,,0,,0,,121.037376403809,1350,,31,,,,,,,8,,,,,0,435,0,,1,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,4.75228261947632,0,,,,,
+9251030970,"May 20, 2023, 1:30:00 AM",Morning Ride,Ride,,14599,88.21,,,false,,TCR ADV 3,,,8,14599,14599,88210,,6.04219484329224,160,,,,,0,,,,,,,,,,,,,,,,,,8,,,,,0,628,0,,0,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,6.04219484329224,0,,,,,
+9251043755,"May 13, 2023, 12:38:00 AM",Morning Ride,Ride,,16303,67.16,,,false,,TCR ADV 3,,,8,16303,16303,67160,,4.11948728561401,366,,,,,0,,,,,,,,,,,,,,,,,,9,,,,,0,815,0,,0,,,,,,,,,,,,,,,,12622314,,,,,,,,,,,0,4.11948728561401,0,,,,,