cat-data-tools 1.0.0__tar.gz → 1.0.2__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.4
2
2
  Name: cat_data_tools
3
- Version: 1.0.0
3
+ Version: 1.0.2
4
4
  Summary: A Python module to process cats data
5
5
  Home-page: https://github.com/IslasGECI/cat_data_tools
6
6
  Author: Ciencia de Datos • GECI
@@ -1,6 +1,6 @@
1
1
  """A Python module to process cats data"""
2
2
 
3
- __version__ = "1.0.0"
3
+ __version__ = "1.0.2"
4
4
  from .cli import * # noqa
5
5
  from .filter_data_between_years import * # noqa
6
6
  from .filter_data_by_month import * # noqa
@@ -23,7 +23,7 @@ def write_daily_effort_and_captures_summary_by_zone(
23
23
  trap_daily_status_path: str = typer.Option(),
24
24
  output_path: str = typer.Option(),
25
25
  ):
26
- trap_daily_status_df = pd.read_csv(trap_daily_status_path)
26
+ trap_daily_status_df = adapt_date_column_name(trap_daily_status_path)
27
27
  effort_captures_summary_df = calculate_effort_and_captures(trap_daily_status_df)
28
28
  effort_captures_summary_df_renamed = effort_captures_summary_df.rename(
29
29
  columns={"Date": "Fecha", "Zone": "Zona", "Effort": "Esfuerzo", "Captures": "Capturas"}
@@ -38,7 +38,7 @@ def write_trap_daily_status(
38
38
  island: str = typer.Option(),
39
39
  output_path: str = typer.Option(),
40
40
  ):
41
- traps_check_log_df = pd.read_csv(traps_check_log_path)
41
+ traps_check_log_df = adapt_date_column_name(traps_check_log_path)
42
42
 
43
43
  with open(config_file_path, "r") as file:
44
44
  config = json.load(file)
@@ -49,7 +49,13 @@ def write_trap_daily_status(
49
49
  trap_daily_status_df = build_methods[island](
50
50
  traps_check_log_df, days_active=config["days_active"]
51
51
  )
52
- trap_daily_status_df.to_csv(output_path, index=False)
52
+ trap_daily_status_df_renamed = trap_daily_status_df.rename(columns={"Date": "Fecha"})
53
+ trap_daily_status_df_renamed.to_csv(output_path, index=False)
54
+
55
+
56
+ def adapt_date_column_name(input_path):
57
+ input_df = pd.read_csv(input_path)
58
+ return input_df.rename(columns={"Fecha": "Date"})
53
59
 
54
60
 
55
61
  @app.command()
@@ -10,8 +10,7 @@ def summarize_effort_captures(effort_data):
10
10
 
11
11
  def summarize_effort_captures_and_add_trappers(monthly_trappers, effort_data):
12
12
  monthly_data = summarize_effort_captures(effort_data)
13
- monthly_data["Tramperos"] = monthly_trappers["Tramperos"]
14
- return monthly_data
13
+ return monthly_data.join(monthly_trappers.set_index("Fecha"), on="Fecha")
15
14
 
16
15
 
17
16
  def add_date_column(monthly_data):
File without changes
File without changes