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

FutureWarning with pandas 1.5.0 #2698

Closed
pharmpy-dev-123 opened this issue Oct 19, 2022 · 1 comment
Closed

FutureWarning with pandas 1.5.0 #2698

pharmpy-dev-123 opened this issue Oct 19, 2022 · 1 comment
Labels

Comments

@pharmpy-dev-123
Copy link

Using .to_dict() on an altair 4.2.0 object I get the following FutureWarning with pandas 1.5.0:

.tox/py39-unit/lib/python3.9/site-packages/altair/vegalite/v4/api.py:384: in to_dict
    dct = super(TopLevelMixin, copy).to_dict(*args, **kwargs)
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:326: in to_dict
    result = _todict(
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:60: in _todict
    return {
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:61: in <dictcomp>
    k: _todict(v, validate, context)
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:58: in _todict
    return [_todict(v, validate, context) for v in obj]
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:58: in <listcomp>
    return [_todict(v, validate, context) for v in obj]
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/schemapi.py:56: in _todict
    return obj.to_dict(validate=validate, context=context)
.tox/py39-unit/lib/python3.9/site-packages/altair/vegalite/v4/api.py:2020: in to_dict
    return super().to_dict(*args, **kwargs)
.tox/py39-unit/lib/python3.9/site-packages/altair/vegalite/v4/api.py:374: in to_dict
    copy.data = _prepare_data(original_data, context)
.tox/py39-unit/lib/python3.9/site-packages/altair/vegalite/v4/api.py:89: in _prepare_data
    data = _pipe(data, data_transformers.get())
.tox/py39-unit/lib/python3.9/site-packages/toolz/functoolz.py:628: in pipe
    data = func(data)
.tox/py39-unit/lib/python3.9/site-packages/toolz/functoolz.py:304: in __call__
    return self._partial(*args, **kwargs)
.tox/py39-unit/lib/python3.9/site-packages/altair/vegalite/data.py:19: in default_data_transformer
    return curried.pipe(data, limit_rows(max_rows=max_rows), to_values)
.tox/py39-unit/lib/python3.9/site-packages/toolz/functoolz.py:628: in pipe
    data = func(data)
.tox/py39-unit/lib/python3.9/site-packages/toolz/functoolz.py:304: in __call__
    return self._partial(*args, **kwargs)
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/data.py:149: in to_values
    data = sanitize_dataframe(data)
.tox/py39-unit/lib/python3.9/site-packages/altair/utils/core.py:317: in sanitize_dataframe
    for col_name, dtype in df.dtypes.iteritems():
.tox/py39-unit/lib/python3.9/site-packages/pandas/core/series.py:1845: in iteritems
    warnings.warn(
E   FutureWarning: iteritems is deprecated and will be removed in a future version. Use .items instead.

I believe it's just a matter of using .items() rather than .iteritems(). .items() was introduced for Python 3 only in pandas-dev/pandas@16dbeab and then for Python 2 in pandas-dev/pandas@3b02e73.

Since altair requires Python >= 3.7 this should not conflict with the current requirements of pandas>=0.18.

@joelostblom
Copy link
Contributor

Thanks, A fix for this has been suggested in #2683

@mattijn mattijn closed this as completed Oct 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants