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 type checks to not fail if first value in series is NaN/missing. #174

Merged
merged 2 commits into from
Sep 8, 2020

Conversation

henrifroese
Copy link
Collaborator

Currently, when using our InputSeries decorator, it always throws an error if the first Series value is NaN. This of course makes no sense for users.

Example:

>>> import pandas as pd
>>> import texthero as hero
>>> s = pd.Series([pd.NA, "test"])
>>> hero.clean(s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/henri/Prog/SummerOfCode/texthero/texthero/texthero/_types.py", line 233, in wrapper
    allowed_hero_series_type.check_series(s)
  File "/home/henri/Prog/SummerOfCode/texthero/texthero/texthero/_types.py", line 124, in check_series
    raise TypeError(error_string)
TypeError: The input Series should consist only of strings in every cell. See help(hero.HeroSeries) for more information.

We fix this by finding the first non-NaN value now and checking this.

Co-authored-by: Maximilian Krahn <maximilian.krahn@icloud.com>
@henrifroese
Copy link
Collaborator Author

Accidentally pushed the nlp tutorial on here, so had to force-push one commit back. It's now back at the correct commit (0cca7d9) 🙃

@henrifroese henrifroese added the bug Something isn't working label Sep 6, 2020
@jbesomi jbesomi mentioned this pull request Sep 8, 2020
@jbesomi jbesomi merged commit 55e7a2d into jbesomi:master Sep 8, 2020
@jbesomi
Copy link
Owner

jbesomi commented Sep 8, 2020

Good catch, thanks! 🎉

When reviewing, I noticed a couple of other issues (see #180 ) that preferably need to be dealt with separately (one PR for each issue). Would you mind looking into that, please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants