python-table-processor 0.3.5__py3-none-any.whl → 0.3.6__py3-none-any.whl

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.1
2
2
  Name: python-table-processor
3
- Version: 0.3.5
3
+ Version: 0.3.6
4
4
  Summary: A table data processor
5
5
  Home-page: https://github.com/akivajp/python-table-processor
6
6
  License: MIT
@@ -1,7 +1,7 @@
1
- table_processor/__init__.py,sha256=gtxdmTbOklsCYOkQEth0hoRHsSwKt1ixChUIQPBOStA,52
1
+ table_processor/__init__.py,sha256=NnfhwEniUS8sdLDZO-0YfiWrkT_whyk4dJmhf1LDoHs,52
2
2
  table_processor/cli.py,sha256=uluf_VsBzq3Ldxh3ePGseSrv8--lI7huu-6RjDaHPPg,2170
3
3
  table_processor/commands/convert_tables.py,sha256=w4IZftSlrbt-BMPjldULT_616LSiNE3h7GmrFF7K5OM,2276
4
- table_processor/commands/merge_tables.py,sha256=Uu-hjfPh69Of0_OZrY8sY0oscpLSdK4jwJ_t1qgfPMg,1485
4
+ table_processor/commands/merge_tables.py,sha256=jryGU3gUx2TlGrI6FozGS_aJQvJQFco2LKwun6Uo9KY,1719
5
5
  table_processor/core/actions.py,sha256=GKUKzoPxUEuWSeuY-HsqFoS5Bdm99bjkRhuBgG1s_uk,23658
6
6
  table_processor/core/config.py,sha256=Z1s2r3y4oQXdbDCwIY_hYzoq6VRv7Sb3oUlfBCu13Lc,11646
7
7
  table_processor/core/constants.py,sha256=w-1TxtpXywb6Qh8M4YWuzcCHUvCjy5zJYxaXC3RQS6A,158
@@ -14,10 +14,10 @@ table_processor/core/functions/search_column_value.py,sha256=GscwLaMTORHFDhdCdjz
14
14
  table_processor/core/functions/set_flat_field_value.py,sha256=7-BgD2yEUGyBaFaIJ18bYv82Qdy0CN8NiC5ZtsAdv44,531
15
15
  table_processor/core/functions/set_nested_field_value.py,sha256=csO0v_nW94q-M9bNL91xR-TLHPXDDxnLK8gN-0LLd6k,595
16
16
  table_processor/core/functions/set_row_value.py,sha256=wlF_nVGZY74XCzd6pBJJyti62m6y0s1kc5Q6uq9jn8o,641
17
- table_processor/core/merge.py,sha256=NoxVfhpOr7oxfmMZt1Xqx94fkIhAJQcYuYzR3XcJsns,4809
17
+ table_processor/core/merge.py,sha256=Sqnr-d7XCkRHvypExsHLboJBKxemPWnLNhKB0CuCPN8,5157
18
18
  table_processor/core/types.py,sha256=xNvy1vL1ei87kt-MgSfRJSllYrNKRo23pHtJA15DyLQ,2895
19
- python_table_processor-0.3.5.dist-info/LICENSE,sha256=1_Gn0I1neLPxDLfLiHEyxjDg-pbAra1p2iHEqutGS_c,1068
20
- python_table_processor-0.3.5.dist-info/METADATA,sha256=MA1YvRPDWpWhbua0uFd5AOyFJ7EtxUYJ9XV3bYyr2S8,1098
21
- python_table_processor-0.3.5.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
22
- python_table_processor-0.3.5.dist-info/entry_points.txt,sha256=lq97F6m51yZ93qmVIqkUHJfbILZuYLxrMWXSqrP4JpM,118
23
- python_table_processor-0.3.5.dist-info/RECORD,,
19
+ python_table_processor-0.3.6.dist-info/LICENSE,sha256=1_Gn0I1neLPxDLfLiHEyxjDg-pbAra1p2iHEqutGS_c,1068
20
+ python_table_processor-0.3.6.dist-info/METADATA,sha256=TgRGjK9lb7EFMdnyoZMffMiOz16SR2HEzc7w442DtvE,1098
21
+ python_table_processor-0.3.6.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
22
+ python_table_processor-0.3.6.dist-info/entry_points.txt,sha256=lq97F6m51yZ93qmVIqkUHJfbILZuYLxrMWXSqrP4JpM,118
23
+ python_table_processor-0.3.6.dist-info/RECORD,,
@@ -1,2 +1,2 @@
1
- __version__ = "0.3.5"
2
- __version_tuple__ = (0, 3, 5)
1
+ __version__ = "0.3.6"
2
+ __version_tuple__ = (0, 3, 6)
@@ -15,7 +15,8 @@ def run(
15
15
  keys=args.keys,
16
16
  allow_duplicate_keys=args.allow_duplicate_keys,
17
17
  ignore_not_found=args.ignore_not_found,
18
- output_file=args.output_file,
18
+ output_base_data_file=args.output_base_data_file,
19
+ output_modified_data_file=args.output_modified_data_file,
19
20
  )
20
21
 
21
22
  def setup_parser(
@@ -50,9 +51,13 @@ def setup_parser(
50
51
  help='Ignore not found',
51
52
  )
52
53
  parser.add_argument(
53
- '--output-file', '--output', '-o',
54
- metavar='OUTPUT_FILE',
54
+ '--output-base-data-file', '--output-base',
55
55
  required=False,
56
- help='Path to the output file.',
56
+ help='Path to output base data file',
57
+ )
58
+ parser.add_argument(
59
+ '--output-modified-data-file', '--output-modified',
60
+ required=False,
61
+ help='Path to output modified data file',
57
62
  )
58
63
  parser.set_defaults(handler=run)
@@ -45,7 +45,8 @@ def merge(
45
45
  keys: list[str],
46
46
  allow_duplicate_keys: bool = False,
47
47
  ignore_not_found: bool = False,
48
- output_file: str | None = None,
48
+ output_base_data_file: str | None = None,
49
+ output_modified_data_file: str | None = None,
49
50
  ):
50
51
  ic.enable()
51
52
  ic()
@@ -53,7 +54,8 @@ def merge(
53
54
  ic(modification_files)
54
55
  ic(keys)
55
56
  dict_key_to_row = {}
56
- all_rows = []
57
+ all_base_rows = []
58
+ all_modified_rows = []
57
59
  list_ignored_keys = []
58
60
  num_modified = 0
59
61
  for previous_file in previous_files:
@@ -85,7 +87,7 @@ def merge(
85
87
  ic(index)
86
88
  raise ValueError(f'Duplicate key: {key}')
87
89
  dict_key_to_row[primary_key] = row
88
- all_rows.append(row)
90
+ all_base_rows.append(row)
89
91
  for modification_file in modification_files:
90
92
  if not os.path.exists(modification_file):
91
93
  raise FileNotFoundError(f'File not found: {modification_file}')
@@ -123,6 +125,7 @@ def merge(
123
125
  ic(index)
124
126
  raise ValueError(f'Key not found: {primary_key}')
125
127
  previous_row = dict_key_to_row[primary_key]
128
+ all_modified_rows.append(previous_row)
126
129
  #ic(previous_row)
127
130
  #ic(previous_row.flat)
128
131
  for key, value in row.flat.items():
@@ -141,8 +144,11 @@ def merge(
141
144
  if ignore_not_found:
142
145
  ic(len(list_ignored_keys))
143
146
  ic(list_ignored_keys)
144
- if output_file:
145
- #all_df = pd.DataFrame(all_rows)
146
- all_df = pd.DataFrame([row.flat for row in all_rows])
147
- ic('Saving to: ', output_file)
148
- save(all_df, output_file)
147
+ if output_base_data_file:
148
+ all_df = pd.DataFrame([row.flat for row in all_base_rows])
149
+ ic('Saving to: ', output_base_data_file)
150
+ save(all_df, output_base_data_file)
151
+ if output_modified_data_file:
152
+ all_df = pd.DataFrame([row.flat for row in all_modified_rows])
153
+ ic('Saving to: ', output_modified_data_file)
154
+ save(all_df, output_modified_data_file)