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

Refactor BeliefsDataFrame initialization by detecting the initialization method #40

Open
Flix6x opened this issue Nov 26, 2020 · 0 comments

Comments

@Flix6x
Copy link
Collaborator

Flix6x commented Nov 26, 2020

We currently have 5 distinct ways of initializing a BeliefsDataFrame (see below), all handled by a single __init__ function. It's not very clear which method is being supported by each code block in this function. We should detect the initialization method early on and call separate functions for each method to keep it clean. Alternatively, we could implement separate class methods for alternative constructors. This is what Geopandas (a more advanced library that subclasses pandas Series and DataFrames) does.

Initialization methods

  1. from a list of timely_beliefs.TimedBelief objects
  2. from a pandas.DataFrame object and a timely_beliefs.Sensor object
  3. from a pandas.Series object and a timely_beliefs.Sensor object
  4. from a timely_beliefs.BeliefsSeries object (undocumented)
  5. from a timely_beliefs.BeliefsDataFrame object (undocumented)

And a 6th implemented as a separate function (timely_beliefs.read_csv) that uses method 2 internally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant