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

Make Series.astype(bool) follow the concept of "truthy" and "falsey". #1431

Merged
merged 2 commits into from
Apr 20, 2020

Conversation

ueshin
Copy link
Collaborator

@ueshin ueshin commented Apr 17, 2020

Making Series.astype(bool) follow the concept of "truthy" and "falsey".

>>> kser = ks.Series(["hi", "hi ", " ", " \t", "", None], name="x")
>>> kser
0      hi
1     hi
2
3      \t
4
5    None
Name: x, dtype: object
>>> kser.astype(bool)
0     True
1     True
2     True
3     True
4    False
5    False
Name: x, dtype: bool
>>> kser.str.strip().astype(bool)
0     True
1     True
2    False
3    False
4    False
5    False
Name: x, dtype: bool

Resolves #1430.

@ueshin ueshin requested a review from HyukjinKwon April 17, 2020 19:45
@codecov-io
Copy link

codecov-io commented Apr 17, 2020

Codecov Report

Merging #1431 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #1431   +/-   ##
=======================================
  Coverage   95.14%   95.14%           
=======================================
  Files          34       34           
  Lines        7967     7974    +7     
=======================================
+ Hits         7580     7587    +7     
  Misses        387      387           
Impacted Files Coverage Δ
databricks/koalas/series.py 96.95% <100.00%> (+0.02%) ⬆️
databricks/koalas/typedef.py 82.84% <100.00%> (ø)

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 83e44bf...dafcf56. Read the comment docs.

@HyukjinKwon HyukjinKwon merged commit 8f923c9 into databricks:master Apr 20, 2020
@ueshin ueshin deleted the astype branch April 20, 2020 17:40
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.

Series.astype() does not not respect "truthyness" as in pandas
3 participants