瀏覽代碼

added pandas day alias to fix problem when using hercules with resolutions < 1 month

Signed-off-by: Jeffrey McAteer <jeffrey.p.mcateer@gmail.com>
Jeffrey McAteer 5 年之前
父節點
當前提交
5ff6aa1d73
共有 1 個文件被更改,包括 6 次插入1 次删除
  1. 6 1
      python/labours/modes/burndown.py

+ 6 - 1
python/labours/modes/burndown.py

@@ -328,7 +328,7 @@ def load_burndown(
         )
         daily[(last - start).days :] = 0
         # Resample the bands
-        aliases = {"year": "A", "month": "M"}
+        aliases = {"year": "A", "month": "M", "day": "D"}
         resample = aliases.get(resample, resample)
         periods = 0
         date_granularity_sampling = [start]
@@ -343,6 +343,11 @@ def load_burndown(
                 return load_burndown(
                     header, name, matrix, "month", report_survival=False
                 )
+            elif resample == "M":
+                print("too loose resampling - by month, trying by day")
+                return load_burndown(
+                    header, name, matrix, "day", report_survival=False
+                )
             else:
                 raise ValueError("Too loose resampling: %s. Try finer." % resample)
         date_range_sampling = pandas.date_range(