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

Pandas 1.0.0 breaks the result set. #1283

Closed
drvinceknight opened this issue Feb 4, 2020 · 2 comments · Fixed by #1288
Closed

Pandas 1.0.0 breaks the result set. #1283

drvinceknight opened this issue Feb 4, 2020 · 2 comments · Fixed by #1288

Comments

@drvinceknight
Copy link
Member

When running the tests for the result set:

python -m unittest 

with pandas 0.25.3 everything passes but with 1.0.0 we get errors:

  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/dask/local.py", line 222, in execute_task
    result = _execute_task(task, data)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/dask/core.py", line 119, in _execute_task
    return func(*args2)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/dask/utils.py", line 29, in apply
    return func(*args, **kwargs)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/dask/dataframe/groupby.py", line 279, in _groupby_aggregate
    return aggfunc(df.groupby(level=levels, sort=False, **dropna), **kwargs)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/frame.py", line 5807, in groupby
    observed=observed,
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/groupby/groupby.py", line 409, in __init__
    mutated=self.mutated,
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/groupby/grouper.py", line 625, in get_grouper
    if not isinstance(gpr, Grouping)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/groupby/grouper.py", line 287, in __init__
    ) = index._get_grouper_for_level(self.grouper, level)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/indexes/multi.py", line 1267, in _get_grouper_for_level
    grouper = level_index.take(codes, fill_value=True)
  File "/Users/vince/anaconda3/envs/axelrod/lib/python3.7/site-packages/pandas/core/indexes/base.py", line 761, in take
    f"Unable to fill values because {cls_name} cannot contain NA"
ValueError: Unable to fill values because Int64Index cannot contain NA

This has happened on #1282.

@marcharper
Copy link
Member

I'm using Pandas 1.0.1 and I don't seem to get this error with the following command:

python -m unittest axelrod.tests.unit.test_resultset

However I do get many warnings of the form:

.../axelrod/result_set.py:424: RuntimeWarning: invalid value encountered in true_divide
  np.nan_to_num(np.array(self.initial_cooperation_count) / interactions_array)
.../axelrod/result_set.py:411: RuntimeWarning: invalid value encountered in true_divide
  / sum(map(np.array, self.match_lengths))

@drvinceknight
Copy link
Member Author

That's strange... I'll investigate further!

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 a pull request may close this issue.

2 participants