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

Add field_list and data methods to archives #412

Merged
merged 4 commits into from
Nov 10, 2023
Merged

Add field_list and data methods to archives #412

merged 4 commits into from
Nov 10, 2023

Conversation

btjanaka
Copy link
Member

@btjanaka btjanaka commented Nov 10, 2023

Description

The overall goal of this PR is to make it easier to access the data contained in each archive.

TODO

  • Introduce a data() method that returns the archive data in many forms -> this method primarily passes calls to ArrayStore.data
  • Test data() by modifying old as_pandas tests (we do not place too much emphasis on testing since ArrayStore.data is already tested fairly thoroughly)
  • Add a field_list method that shows the list of all fields in the archive

Questions

Status

  • I have read the guidelines in
    CONTRIBUTING.md
  • I have formatted my code using yapf
  • I have tested my code by running pytest
  • I have linted my code with pylint
  • I have added a one-line description of my change to the changelog in
    HISTORY.md
  • This PR is ready to go

@btjanaka btjanaka merged commit c26b63a into master Nov 10, 2023
18 checks passed
@btjanaka btjanaka deleted the data-method branch November 10, 2023 03:50
btjanaka added a commit that referenced this pull request Nov 10, 2023
## Description

<!-- Provide a brief description of the PR's purpose here. -->

Due to the new `data` method (#412), `as_pandas` is no longer necessary,
as `data` provides more flexible options for accessing archive data, and
it is also able to return dataframes by passing `return_type="pandas"`.

This PR thus deprecates `as_pandas`. Because this is a fairly popular
method, I have kept the method and raised a RuntimeError whenever it is
called; however, I anticipate removing the method entirely in the
future.

I also considered keeping `as_pandas` as an alias to
`data(return_type="pandas")`, but this would require changing the
parameters of `as_pandas` since `data` takes in `fields` rather than
`include_solutions` and `include_metadata`. Removing `as_pandas`
entirely makes it clear that it has been deprecated.

## TODO

<!-- Notable points that this PR has either accomplished or will
accomplish. -->

- [x] Introduce a `data()` method that returns the archive data in many
forms
- [x] Remove `as_pandas()` since `data(return_type="pandas")` now
fulfills this role
- [x] Replace as_pandas test with data test
- [x] Fix usage of as_pandas in tests
- [x] Remove as_pandas in tutorials

## Questions

<!-- Any concerns or points of confusion? -->

## Status

- [x] I have read the guidelines in

[CONTRIBUTING.md](https://github.com/icaros-usc/pyribs/blob/master/CONTRIBUTING.md)
- [x] I have formatted my code using `yapf`
- [x] I have tested my code by running `pytest`
- [x] I have linted my code with `pylint`
- [x] I have added a one-line description of my change to the changelog
in
      `HISTORY.md`
- [x] This PR is ready to go
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.

None yet

1 participant