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

Chore/dataframe formatter handle nulls #245

Merged
merged 5 commits into from
Feb 18, 2021

Conversation

timabrmsn
Copy link
Contributor

This updates our DataFrameOutputFormatter to automatically convert "null" values in the dataframe (None, numpy.NaN) to empty strings when outputting to table or CSV. For json output pandas automatically converts these to a json null.

I refactored it a bit to hopefully be a little clearer, and updated the tests to validate the expected result instead of a specific implementation detail.

@github-actions
Copy link

github-actions bot commented Feb 16, 2021

CLA Assistant Lite bot All contributors have signed the CLA ✍️

maddie-vargo added a commit to maddie-vargo/code42cli that referenced this pull request Feb 16, 2021
)
def get_formatted_output(self, df, **kwargs):
if self.output_format == OutputFormat.JSON:
defaults = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could use a helper method _get_json_defaults(lines=True) to share this part with the .RAW part

@timabrmsn timabrmsn merged commit d71a2f5 into master Feb 18, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Feb 18, 2021
@timabrmsn timabrmsn deleted the chore/dataframe_formatter_handle_nulls branch February 22, 2021 16:32
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants