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

ak.Index Updates #1470

Closed
Ethan-DeBandi99 opened this issue Jun 2, 2022 · 1 comment · Fixed by #1482
Closed

ak.Index Updates #1470

Ethan-DeBandi99 opened this issue Jun 2, 2022 · 1 comment · Fixed by #1482
Assignees
Labels
enhancement New feature or request

Comments

@Ethan-DeBandi99
Copy link
Contributor

ak.Index constructor is bare bones and needs to be made more robust. Additionally, there is functionality within pandas.Index that we should add in order to provide more flexibility with functionality. This will make interactions with other objects, specifically ak.DataFrame more streamline.

  • Update __init__ to allow for more types. Currently, we can really only init with a pdarray.
    • Add error handling
    • init properties that are missing when compared to Pandas.
  • Currently, Index.index returns the underlying pdarray, pandas.Index.values does this. We should probably support both (at least for a limited time).
  • Add functionality supported by pandas.Index
@Ethan-DeBandi99 Ethan-DeBandi99 self-assigned this Jun 2, 2022
@Ethan-DeBandi99 Ethan-DeBandi99 added the enhancement New feature or request label Jun 2, 2022
@Ethan-DeBandi99
Copy link
Contributor Author

@reuster986 - Should ak.Index.to_pandas() return a pandas.Index object? Currently, it returns the underlying pdarray as an an ndarray via self.index.to_ndarray. I would think that we would want this to function as it does with ak.DataFrame to return the equivalent pandas object. However, I did not want to update it if this will break anything you are doing elsewhere.

mhmerrill pushed a commit that referenced this issue Jun 8, 2022
* Configured ak.Index existing feature to work more in line with pandas where needed. Namely, the __init and __getitem__ functions."

Updated to_pandas() to return pd.Index and added to_ndarray to maintain the current functionality.

Updated tests to properly utilize ak.Index objects.

* Updated typing information for mypy

* Updating from PR comments.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant