apmtools 0.2.31__tar.gz → 0.2.32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: apmtools
3
- Version: 0.2.31
3
+ Version: 0.2.32
4
4
  Summary: A collection of tools for processing air pollution monitoring data
5
5
  Project-URL: Homepage, https://github.com/federlorenz/apmtools
6
6
  Author-email: Federico Lorenzetti <lorenzetti.federico@gmail.com>
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "apmtools"
7
- version = "0.2.31"
7
+ version = "0.2.32"
8
8
  authors = [
9
9
  { name="Federico Lorenzetti", email="lorenzetti.federico@gmail.com" },
10
10
  ]
@@ -1454,9 +1454,26 @@ class Summary(pd.DataFrame):
1454
1454
  else:
1455
1455
  output = df
1456
1456
 
1457
- output = output[value_cols].agg(aggregate)
1457
+ if isinstance(frequency, str) and aggregate is None:
1458
+ if grouping_by != None:
1459
+ output = df[grouping_by+[frequency]]
1460
+ else:
1461
+ output = df[[frequency]]
1462
+ if isinstance(frequency, list) and aggregate is None:
1463
+ if grouping_by != None:
1464
+ output = df[grouping_by+frequency]
1465
+ else:
1466
+ output = df[frequency]
1467
+ if frequency == None and aggregate is None:
1468
+ if grouping_by != None:
1469
+ output = df[grouping_by]
1470
+ else:
1471
+ output = df
1472
+
1473
+ if aggregate is not None:
1474
+ output = output[value_cols].agg(aggregate)
1458
1475
 
1459
- if frequency != None or grouping_by != None:
1476
+ if aggregate != None and (frequency != None or grouping_by != None):
1460
1477
  output.columns = [
1461
1478
  "_".join(str(x) for x in col if pd.notna(x) and x != "")
1462
1479
  for col in output.columns.to_flat_index()
@@ -1472,8 +1489,8 @@ class Summary(pd.DataFrame):
1472
1489
  output.m["aggregate"] = aggregate
1473
1490
 
1474
1491
  return output
1475
-
1476
-
1492
+
1493
+
1477
1494
  def get_monitor(self, value):
1478
1495
 
1479
1496
  out = self.subset({"monitor": [value]})