-
Notifications
You must be signed in to change notification settings - Fork 0
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
New functionality: --replace-headers
#45
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #45 +/- ##
===========================================
+ Coverage 96.34% 100.00% +3.65%
===========================================
Files 1 1
Lines 602 631 +29
Branches 124 132 +8
===========================================
+ Hits 580 631 +51
+ Misses 17 0 -17
+ Partials 5 0 -5 ☔ View full report in Codecov by Sentry. |
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.
This seems to do what I was hoping for. One small thing is if you have a blank line in your mapping file, it reports it as an error. It would be nice to skip over blank lines so people can organize their field renaming with gaps between them. As an added feature it would be nice to allow comment lines starting with "#" that are ignored. This already works for limit-xpaths files, probably just because there will never be an XML tag that starts with "#" so it never matches.
Replaces column names in a DataFrame or list of XPaths using a mapping file. | ||
|
||
This function determines the output depending on whether an index file or a | ||
headers file is being generated. If an index is True, it will output a new DataFrame |
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.
Shouldn't say "an index".
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.
Also really df
and index
are redundant fields. You can't specify index=True
without also specifying df
. I would delete the index
argument entirely, and just check to see if df
is None. However, at that point, df
and xpaths
are redundant - you must specify one or the other but not both. So really you just want a single argument called something like df_or_xpaths
. Then in the code you can say if isinstance(df_or_xpaths, pandas.DataFrame):
This pull request will introduce the new feature,
--replace-headers
. This command line argument allows the user to change the names of columns via a user-provided text file. For example, the contents of this file can be:and it will replace the XPath with the given replacement string. This command can be applied to both index files and header files.
Fixes #21