Skip to content

Minor change: reset dataframe index for input data #762

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

Merged
merged 1 commit into from
Mar 22, 2023

Conversation

adamchengtkc
Copy link
Contributor

Description

Reset input Pandas df index when loading dataframe from init_data()

Currently if loading data from dataframe which has duplicated index, pandas will return indexing error. This fix indexing and make copy of the input dataframe (To maintain immutability of user input data)

Checklist

  • [x ] My code follows the PEP 8 style guidelines.
  • [n/a] My code uses type hinting for function and method arguments and return values.
  • [n/a] My code contains descriptive and helpful docstrings
    which are formatted per the Google Python Style Guidelines.
  • [n/a] I have created tests which entirely cover my code.
  • [n/a] The test code either 1. demonstrates at least one valuable use case (e.g. integration tests)
    or 2. verifies that outputs are as expected for given inputs (e.g. unit tests).
  • [n/a] New and existing tests pass locally with my changes.

@AlexanderJuestel
Copy link
Contributor

@adamchengtkc, that is a nice addition to GemPy. I avoided fixing the error that you experiencing to make sure that the user resets the index before passing the data to GemPy.

@adamchengtkc
Copy link
Contributor Author

adamchengtkc commented Feb 23, 2023

Yep that can also work. But I would add catching the indexing error from Pandas and provide more explicit error message to the user on ways to fixing their code

Feel free to close this without merge

@Japhiolite Japhiolite merged commit af31150 into gempy-project:main Mar 22, 2023
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.

3 participants