Adding more parameters to the R table command#56
Open
mahaalbashir wants to merge 2 commits into
Open
Conversation
4468761 to
84c44f9
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #56 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 4 5 +1
Lines 115 161 +46
=========================================
+ Hits 115 161 +46 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ae9d650 to
54e0048
Compare
3e5c0f7 to
f55c99f
Compare
for more information, see https://pre-commit.ci
f55c99f to
2a8dcbf
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The exclude parameter: All the items that the user wants to exclude are deleted from the data before sending it to Python.
The useNA parameter: If useNA = "no", NAs and NaNs are removed from the data before sending it to Python. If useNA = "ifany", the data is sent as is. If useNA = "always" and the data doesn't have NAs, the NA level is added as a factor before sending the data to Python.
Whatever the value of the useNA parameter is, the index and columns parameters are converted to R factors. Using factors guarantees that empty categories are not dropped from the final table and allows the addition of the NA level when useNA = "always".
The factors are manually converted to a Pandas categoricals because reticulate doesn't do this automatically. It just throws away the levels and sends the raw data.
The automatic translation of data between Python and R is disabled so that I can manipulate the data before displaying it. Because reticulate removes the index names and replaces them with numbers, I am resetting the indexes before translating the Python DataFrame to R, and then setting them back after the translation.
One thing to notice is that in the case of useNA = "always", when we inject the NA level, the current Python version will actually delete this column/row because every column/row with all zeros is deleted from the DataFrame. However, a message will be sent to the user to show exactly which column and row were deleted.
A utils.R file is created to hold the helper functions.