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

field filter array dereference #302

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Liyuan-Chen-1024
Copy link
Contributor

fix #227

@Liyuan-Chen-1024 Liyuan-Chen-1024 requested review from atbenmurray and ericspod and removed request for atbenmurray July 4, 2022 13:29
@Liyuan-Chen-1024
Copy link
Contributor Author

[] how to separate two cases: apply_filter, and apply_index?
Should we use logic below: if filter_to_apply is boolean type, then [] will call apply_filter, otherwise, it will call apply_index?

@@ -143,6 +143,27 @@ def _ensure_valid(self):
if not self._valid_reference:
raise ValueError("This field no longer refers to a valid underlying field object")

def __getitem__(self, item:Union[list, tuple, np.ndarray]):
if isinstance(item, slice):
# TODO
Copy link
Member

@atbenmurray atbenmurray Jul 25, 2022

Choose a reason for hiding this comment

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

You can forward to the self.data getitem in the general case and then wrap the result in a mem field

Copy link
Member

Choose a reason for hiding this comment

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

The data can be acquired with self.data[slice] I think, this can then be put into a mem field.

# TODO
pass
elif isinstance(item, int):
# TODO
Copy link
Member

Choose a reason for hiding this comment

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

You can get an array of a single value with self.data[[item]] and then put that into a mem field.

# TODO
pass
elif isinstance(item, int):
# TODO
Copy link
Member

Choose a reason for hiding this comment

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

same for this

@codecov-commenter
Copy link

codecov-commenter commented Sep 1, 2022

Codecov Report

Merging #302 (6a6f15f) into master (bc66b84) will increase coverage by 0.04%.
The diff coverage is 96.15%.

@@            Coverage Diff             @@
##           master     #302      +/-   ##
==========================================
+ Coverage   83.39%   83.43%   +0.04%     
==========================================
  Files          22       22              
  Lines        6191     6213      +22     
  Branches     1247     1252       +5     
==========================================
+ Hits         5163     5184      +21     
  Misses        733      733              
- Partials      295      296       +1     
Impacted Files Coverage Δ
exetera/core/fields.py 91.09% <95.83%> (+0.06%) ⬆️
exetera/core/dataframe.py 87.36% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

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.

Dataframe/Field array syntax for filtering and indexing
4 participants