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

Adding few changes for metadata #375

Merged
merged 10 commits into from
Dec 11, 2024
Merged

Adding few changes for metadata #375

merged 10 commits into from
Dec 11, 2024

Conversation

gviejo
Copy link
Contributor

@gviejo gviejo commented Dec 4, 2024

This PR fixed a few issues I found on metadata.

tsdframe = nap.TsdFrame(t=np.arange(10),d=np.random.randn(10,3), columns=['aa', 'bb', 'cc'])

This was working tsdframe[['aa', 'bb']]
This was not tsdframe['aa']

It would try to access ['a', 'a']

  1. Changing
    elif isinstance(key, list) and all(isinstance(k, str) for k in key): line 348 of TsGroup to
    elif isinstance(key, list) and len(key) and all(isinstance(k, str) for k in key):

  2. Improved repr of TsGroup. Was throwing an error when TsGroup was empty.

  3. Changing the init of TsGroup within TsGroup to avoid deprecation message. **self._metadata[cols]) -> metadata=self._metadata[cols]

TODO :

Updating repr to remove vertical bars

To discuss to whether or not keep .loc in case you want to do column indexing with integers

  1. .get_col method to replace .loc
  2. adding a default column label "col_n" for TsdfFrame to remove ambiguity over numpy indexing.
  3. Allow integers and maybe a warning.

Copy link

codecov bot commented Dec 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Files with missing lines Coverage Δ
pynapple/core/interval_set.py 94.30% <100.00%> (+0.67%) ⬆️
pynapple/core/time_series.py 89.55% <100.00%> (+0.08%) ⬆️
pynapple/core/ts_group.py 92.34% <100.00%> (+0.07%) ⬆️
pynapple/io/interface_nwb.py 79.32% <100.00%> (ø)

... and 2 files with indirect coverage changes

@gviejo gviejo merged commit 17faa1e into dev Dec 11, 2024
15 checks passed
@gviejo gviejo deleted the small_fix_metadata branch December 11, 2024 19:21
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.

1 participant