@@ -34,9 +34,9 @@ def fix_times(df):
34
34
"""Converts start and end columns to datetime format and adds an 'Hours_Worked' column
35
35
containing a Timedelta of each session."""
36
36
df = df .assign (
37
- start = pd .to_datetime (df ['start' ], dayfirst = True ),
38
- end = pd .to_datetime (df ['end' ], dayfirst = True ),
39
- Hours_Worked = lambda x : (x .end - x .start ) / pd .Timedelta (hours = 1 )
37
+ start = pd .to_datetime (df ['start' ], dayfirst = True ),
38
+ end = pd .to_datetime (df ['end' ], dayfirst = True ),
39
+ Hours_Worked = lambda x : (x .end - x .start ) / pd .Timedelta (hours = 1 )
40
40
)
41
41
return df
42
42
@@ -49,7 +49,7 @@ def dataframe_from_json(filepath):
49
49
for index , project in enumerate (data ['projects' ]):
50
50
temp_df = (
51
51
pd .DataFrame (project ['sessions' ])
52
- .assign (Project = project ['project_name' ])
52
+ .assign (Project = project ['project_name' ])
53
53
)
54
54
projects .append (temp_df )
55
55
df = (
@@ -78,15 +78,15 @@ def plot_timeseries_bar(projects, frequency):
78
78
project .pipe (fix_times )
79
79
.resample (frequency , on = 'start' ).sum ().reset_index ()
80
80
.rename (columns = {'start' :"Date" })
81
- .assign (Project = project ['Project' ][0 ])
81
+ .assign (Project = project ['Project' ][0 ])
82
82
)
83
83
resampled_projects .append (temp_df )
84
84
resampled_df = pd .concat (resampled_projects )
85
85
fig = (
86
86
px .bar (resampled_df , x = 'Date' , y = 'Hours_Worked' , color = "Project" , title = 'Daily Work' )
87
87
.show ()
88
88
)
89
-
89
+
90
90
91
91
def read_arguments ():
92
92
"""Defines the command-line arguments for this script and fetches those arguments"""
0 commit comments