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

Create a TsGroup from an iterable of Ts/Tsd objects #305

Merged
merged 3 commits into from
Aug 12, 2024

Conversation

eschombu
Copy link
Contributor

It doesn't seem to make a ton of sense to me to require that users manually package their timestamp/series objects into a dict when creating TsGroup objects, since the keys are required to be unique integers. I would guess that the vast majority of the time, users would be just doing {0: ts0, 1: ts1, ...}. Sure, this can be easily done by saying data = dict(enumerate(ts_list)), but why not just allow the user to say data = ts_list and do the dict creation automatically?

If the change described above is not desired, the second commit is probably still worth including. It ensures that the keys in .data and .index are in the same order by doing this:

data = {k: data[k] for k in self.index}

This might not be assured if bypass_check == True.

I added some tests for the new functionality. Again, any and all feedback/concerns/thoughts are welcome!

@eschombu eschombu requested a review from gviejo as a code owner June 26, 2024 22:56
Copy link
Contributor

@gviejo gviejo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

@gviejo
Copy link
Contributor

gviejo commented Jul 5, 2024

You can check the linting with the following commands :

black --check pynapple
isort --check pynapple --profile black
flake8 pynapple --max-complexity 10
coverage run --source=pynapple --branch -m pytest tests/
coverage report -m

@gviejo gviejo changed the base branch from main to dev July 5, 2024 08:39
@eschombu eschombu force-pushed the tsgroup-from-iter branch from f1dab4d to 64ffdc0 Compare August 9, 2024 18:37
@eschombu
Copy link
Contributor Author

eschombu commented Aug 9, 2024

Reformatted with black, hopefully all good now. Let me know if you have any further comments/requests/suggestions.

@gviejo
Copy link
Contributor

gviejo commented Aug 12, 2024

Great thanks Eric

@gviejo gviejo merged commit 43d4e7f into pynapple-org:dev Aug 12, 2024
11 checks passed
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

Successfully merging this pull request may close these issues.

2 participants