-
Notifications
You must be signed in to change notification settings - Fork 18
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
👌 Allow more natural column names in pandas parameters file reading #1174
Conversation
Sourcery Code Quality Report✅ Merging this PR will increase code quality in the affected files by 0.85%.
Here are some functions in these files that still need a tune-up:
Legend and ExplanationThe emojis denote the absolute quality of the code:
The 👍 and 👎 indicate whether the quality has improved or gotten worse with this pull request. Please see our documentation here for details on how these metrics are calculated. We are actively working on this report - lots more documentation and extra metrics to come! Help us improve this quality report! |
Codecov ReportBase: 87.6% // Head: 87.7% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #1174 +/- ##
=======================================
+ Coverage 87.6% 87.7% +0.1%
=======================================
Files 103 103
Lines 4898 4904 +6
Branches 806 808 +2
=======================================
+ Hits 4291 4304 +13
+ Misses 489 486 -3
+ Partials 118 114 -4
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agree, let's move the column renaming out of the parameters.py, validity of column names should be checked at parsing time (it's part of the user-facing API and should be validated, and errors (e.g. typos) reported back to the user.
In this case, csv.py and xlsx.py can handle the renaming.
Some other remarks while reviewing related code:
- from_dataframe implicitly introduces required column names (e.g. minimum, maximum, non_negative, vary) which are not required in other input formats (e.g. yaml) because they have default values. This should not behave differently in that regard.
- please allow for shorthand notation as well (expr | expression, min | minimum, etc)
Also please, if possible, check for (accidental) capitalization and provide feedback to the user (error in yaml, warning in csv/xlsx). However, in the case of xlsx format just ignore it (lowercase it) (e.g. LibreOffice does auto capitalization of string labels). |
PR glotaran#1135 changed the colmn names from 'non-negative' -> 'non_negative' and 'standard-error' -> 'standard_error' which causes crashes in load_parameters when reading parameters files that were created before the merge (e.g. 'optimized_parameters.csv'). This change allows reading of those old files, while saving still uses the new version
e47be7e
to
6aa60e6
Compare
👌 Allow alternate notation used in yaml for pandas plugins 👌 Make column names case insensitive for pandas plugins
bb9696c
to
1d196c3
Compare
1d196c3
to
2af0143
Compare
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
The requested changes has been implemented. parameters.py no longer does df.rename, its has moved to csv.py and xlsx.py
PR #1135 changed the column names from 'non-negative' -> 'non_negative' and 'standard-error' -> 'standard_error' which causes crashes in load_parameters when reading parameters files that were created before the merge (e.g. 'optimized_parameters.csv').
In addition to reenabling the reading of old parameter files saved with the
pandas
plugins (csv
,tsv
,xlsx
,ods
), this PR allows the same more natural/shorter column names which are allowed inyaml
files for thepandas
plugins and casts the column names to lower strings to counter capitalization problems caused by auto-capitalization fromexcel
and the likes.pyglotaran/glotaran/parameter/parameter.py
Lines 39 to 45 in e70f760
And it removed the unintended requirement to define the
non_negative
andvary
columns, which are optional and can be filled with default values.Change summary
Checklist