Skip to content

Fix column ordering in Python, null handling for computed columns#907

Merged
texodus merged 4 commits intomasterfrom
python-fixes
Feb 8, 2020
Merged

Fix column ordering in Python, null handling for computed columns#907
texodus merged 4 commits intomasterfrom
python-fixes

Conversation

@sc1f
Copy link
Contributor

@sc1f sc1f commented Feb 5, 2020

This PR provides several fixes for issues with PerspectivePython:

  • When passing in a pandas.DataFrame, Perspective will read the columns property and load the dataframe in the specified order. Perspective will continue to call .keys() for datasets composed of Python dict and list values, and the canonical way to determine column order should be through creating a View with the columns kwarg set. This change simply makes Perspective's column layout more symmetrical with that of the provided DataFrame.
  • When creating a View, columns included in aggregates but not in columns will not have their aggregates applied. This fixes issue Pivoted PerspectiveWidget column order broken in Python 2 #904, which occurred because the order of .keys() in aggregates !=the order ofcolumns`.
  • Computed columns will write null to the output column if any value provided to the computed function is null or undefined.

@sc1f sc1f added bug Concrete, reproducible bugs internal Internal refactoring and code quality improvement C++ JS Python labels Feb 5, 2020
Copy link
Member

@texodus texodus left a comment

Choose a reason for hiding this comment

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

Thanks for the PR! Looks good!

At some point we should return and specify the semantics of "natural column order" of a perspective.Table

@texodus texodus merged commit 83bf961 into master Feb 8, 2020
@texodus texodus deleted the python-fixes branch February 8, 2020 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Concrete, reproducible bugs C++ internal Internal refactoring and code quality improvement JS Python

Development

Successfully merging this pull request may close these issues.

3 participants