Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement map method for TimeSeries class #121

Closed
pennfranc opened this issue Jul 2, 2020 · 1 comment
Closed

Implement map method for TimeSeries class #121

pennfranc opened this issue Jul 2, 2020 · 1 comment
Labels
feature request Use this label to request a new feature good first issue Good for newcomers

Comments

@pennfranc
Copy link
Contributor

Missing functionality
Although adding or multiplying a scalar value to every entry in a TimeSeries instance is very easy, when it comes to more complex element-wise operations (e.g. taking the sine function value of every entry in the series) there is no easy way to create a new TimeSeries instance, given a TimeSeries instance and operation.

Proposed solution
The most straight-forward way to implement this functionality would be implement a map function that takes as arguments a TimeSeries and a function, and returns a new TimeSeries instance (pretty much like the built-in python function).

@pennfranc pennfranc added feature request Use this label to request a new feature good first issue Good for newcomers labels Jul 2, 2020
TheMP pushed a commit that referenced this issue Jul 23, 2020
* Implement map method for TimeSeries

An implementation for map is added. It uses pandas' applymap method.
A jupyter notebook to show the tests conducted.

Resolves: #121

* Remove test_map jupyter notebook

* Add unit tests for and check within map method

Unit tests test_map.py added.
Included a small check, that the indices are in a valid range, in map method in TimeSeries class.

* Make minor adjustments to map method

Following hrzn's advice, various minor adjustments were made:
* Correct various spacing/wording inconsistencies
* Move contents of test_map.py into test_timeseries.py
* Added sanity test case to tests for map
* Changed type hints to np.number
* Removed an unncessary call to self.pd_dataframe()

* Replace self.pd_dataframe with self._pd in map method

* Add ticks to map method docstring
@TheMP
Copy link
Contributor

TheMP commented Jul 28, 2020

Closing as the issue is resolved and will be out in 0.3.0 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Use this label to request a new feature good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants