Skip to content

COMPAT: Import abstract classes from collections.abc #22020

Closed
@holymonson

Description

@holymonson

Changed in version 3.3: Moved Collections Abstract Base Classes to the collections.abc module. For backwards compatibility, they continue to be visible in this module through Python 3.7. Subsequently, they will be removed entirely.

Numpy team has done it. numpy/numpy#10743

if PY33:
    import collections.abc as collections_abc
else:
    import collections as collections_abc

A problem is collections_abc being too long, isinstance(something, collections_abc.Iterable) occupies half line, but from pandas.compat.collections_abc import Iterable might pollute namespace.


BTW, pandas/compat/__init__.py seems messy. Since Much of the code in this module comes from Benjamin Peterson's six library, why not require six like many other libraries do?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Compatpandas objects compatability with Numpy or Python functionsgood first issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions