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

Fix clip to use _InternalFrame.with_new_columns. #1232

Merged
merged 1 commit into from
Jan 28, 2020

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Jan 28, 2020

Fixes DataFrame/Series.clip function to use _InternalFrame.with_new_columns and preserve its index.

@ueshin ueshin requested a review from HyukjinKwon January 28, 2020 01:18
numeric_columns = [(c, F.when(scol > upper, upper).otherwise(scol).alias(c))
for c, scol in numeric_columns]
numeric_columns = [(idx, (F.when(scol > upper, upper).otherwise(scol)
.alias(name_like_string(idx))))
Copy link
Member

Choose a reason for hiding this comment

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

Hm .. should we maybe not use alias at all against Spark columns whenever possible?

Copy link
Collaborator Author

@ueshin ueshin Jan 28, 2020

Choose a reason for hiding this comment

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

Ideally, we can avoid aliasing, but so far we can't avoid column name access so we should have proper names. Otherwise, e.g., if the name becomes something like "xx`yy" by accident, it throws an error since it breaks the naming rule of Spark.

@HyukjinKwon HyukjinKwon merged commit be69c54 into databricks:master Jan 28, 2020
@codecov-io
Copy link

Codecov Report

Merging #1232 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1232      +/-   ##
==========================================
+ Coverage   95.18%   95.18%   +<.01%     
==========================================
  Files          35       35              
  Lines        7265     7270       +5     
==========================================
+ Hits         6915     6920       +5     
  Misses        350      350
Impacted Files Coverage Δ
databricks/koalas/frame.py 96.97% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 77da5b9...150ed35. Read the comment docs.

@ueshin ueshin deleted the clip branch January 28, 2020 03:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants