Skip to content

Add names argument to ts_merge and ts_splice #50

Open
@water-e

Description

@water-e

ts_merge and ts_splice implement merging of time series avoiding various issues that crop up if you do it naively with indexing. However, one problem both functions have is that it takes a lot of extra code to use them if the column names are different, because Pandas will try to match by column label. If you are drawing from and merging two sources of data for the same quantity this can lead to a ton of "squeeze()" calls, since the desired merging behavior will occur for series with different series names but not for single-column dataframes with different columns. The proposal here is that there be an argument called names which will be used to match columns for merging. So if you are merging two dataframes representing mokelumne flow data and one is called 'moke' and the other 'value' you can say name='value' and it will squeeze and apply this name to the final dataframe.

The project will result in a test_merge.py in /tests that confirms the following:

  1. If you don't use 'names` it will check the arguments as described in the docstring.
  2. If you do, it will use these names. This might require a try/except/finally because it is important not to alter the series coming in. You could rename in "try" and unname in "finally".
  3. Test the advertised behavior for both ts_merge and ts_splice.
  4. Test every switch for ts_merge and ts_splice
  5. Produce a small notebook that shows how they work.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions