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

Convert text variable to string before NumWords #106

Merged
merged 3 commits into from Mar 19, 2018

Conversation

Projects
None yet
3 participants
@Seth-Rothschild
Contributor

Seth-Rothschild commented Mar 7, 2018

This fixes an error that NumWords gives if it encounters a float. This comes up often, as np.NaN is a float. An alternate solution would be to catch the NaNs directly and return 0 or NaN rather than 1.

@codecov-io

This comment has been minimized.

codecov-io commented Mar 7, 2018

Codecov Report

Merging #106 into master will decrease coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #106      +/-   ##
==========================================
- Coverage   88.18%   88.17%   -0.02%     
==========================================
  Files          73       73              
  Lines        7392     7394       +2     
==========================================
+ Hits         6519     6520       +1     
- Misses        873      874       +1
Impacted Files Coverage Δ
featuretools/primitives/transform_primitive.py 97.77% <100%> (+0.01%) ⬆️
featuretools/utils/gen_utils.py 64.44% <0%> (-2.23%) ⬇️

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 4189b0b...59923ba. Read the comment docs.

Seth-Rothschild
return lambda array: pd.Series([x.count(" ") + 1 for x in array])
def word_counter(array):
array = pd.Series(array).fillna('')
return pd.Series([str(x).count(' ') + 1 for x in array])

This comment has been minimized.

@kmax12

kmax12 Mar 8, 2018

Member

Can you just do pd.Series(array).fillna('').str.count(" ") + 1?

@kmax12 kmax12 merged commit 7e7cfd0 into master Mar 19, 2018

2 checks passed

ci/circleci Your tests passed on CircleCI!
Details
license/cla Contributor License Agreement is signed.
Details

@rwedge rwedge referenced this pull request Mar 21, 2018

Merged

Release v0.1.19 #114

@Seth-Rothschild Seth-Rothschild deleted the textprimfix branch Mar 30, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment