This repository was archived by the owner on Jul 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PandasDataFrameResult: Convert non-list values to single row frame (#243
) This fixes behavior around scalars and returning single items. We will now: 1. handle single scalar/object values when only they are present when creating a dataframe. 2. correctly handle a dictionary value as the only result in a dataframe (this fixes a regression). 3. Otherwise no other behavior should be impacted. 4. More unit test coverage added here. Pandas `is_list_like` is key here, and covers objects that aren't pandas types, like dictionaries, lists, which provide some "indexing" with which to build a dataframe from. Thanks @ianhoffman for finding and fixing this! Contents of squashed commits that make this commit up: * Handle scalar values in PandasDataFrameResult * handle requests for all scalar values * PR feedback: * Use `is_list_like` instead of explicitly checking for dataframes and series * Add a bunch of tests for building a result from different types, such as scalars, lists, numpy arrays, mixtures of arrays and dicts, etc. * omit test for nested arrays since they break in Python 3.6. Would be nice to have this at some point though. * PR Feedback: * Tests for objects and scalars + dicts * Improve comment to mention objects as well as scalars * PR feedback: use yield from
- Loading branch information
1 parent
0bd1d05
commit bcdbe13
Showing
2 changed files
with
85 additions
and
5 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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