Skip to content

BUG: passing a non-dict mapping to pd.concat raises a TypeError #32953

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

Merged

Conversation

pbourguignon
Copy link
Contributor

@pbourguignon pbourguignon commented Mar 23, 2020

closes #32954
closes #32863

  • tests added / passed
  • passes black pandas
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

pbourguignon and others added 18 commits March 20, 2020 12:36
While the documentation of ``pandas.DataFrame.concat`` specifies that
any mapping of ``Label`` to ``FrameOrSeries`` is acceptable as the first
argument, the actual test performed checks for an instance of ``dict``.
This changeset fixes that restriction.
This changeset adds a test asserting that pd.concat works as expected
with an `objs` argument of type `Mapping`. It also replaces the explicit
reference to the type `dict` in the corresponding entry of the
docstring.
@jreback jreback added the Testing pandas testing functions or related to the test suite label Mar 25, 2020
@jreback jreback added this to the 1.1 milestone Mar 25, 2020
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

small comments, ping on green.

@@ -412,6 +414,7 @@ Other
- Fixed bug in :func:`pandas.testing.assert_series_equal` where dtypes were checked for ``Interval`` and ``ExtensionArray`` operands when ``check_dtype`` was ``False`` (:issue:`32747`)
- Bug in :meth:`Series.map` not raising on invalid ``na_action`` (:issue:`32815`)
- Bug in :meth:`DataFrame.__dir__` caused a segfault when using unicode surrogates in a column name (:issue:`25509`)
- Fixture :func:`non_mapping_dict_subclass` is now more appropriately called :func:`non_dict_mapping_subclass` (:issue:`32954`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove this; we don't add testing things to the release notes

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -385,8 +385,10 @@ Reshaping
- :meth:`DataFrame.replace` and :meth:`Series.replace` will raise a ``TypeError`` if ``to_replace`` is not an expected type. Previously the ``replace`` would fail silently (:issue:`18634`)
- Bug in :meth:`DataFrame.apply` where callback was called with :class:`Series` parameter even though ``raw=True`` requested. (:issue:`32423`)
- Bug in :meth:`DataFrame.pivot_table` losing timezone information when creating a :class:`MultiIndex` level from a column with timezone-aware dtype (:issue:`32558`)
- Bug in :meth:``pd.concat`` where when passing a non-dict mapping as ``objs`` would raise a TypeError (:issue:`32863`)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use :meth:`concat` instead

put double back-ticks around TypeError

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@jreback jreback changed the title Rename non mapping dict fixture BUG: passing a non-dict mapping to pd.concat raises a TypeError Mar 25, 2020
@jreback jreback mentioned this pull request Mar 25, 2020
5 tasks
@pbourguignon pbourguignon requested a review from jreback March 25, 2020 14:07
@jreback jreback added the Reshaping Concat, Merge/Join, Stack/Unstack, Explode label Mar 26, 2020
@jreback jreback merged commit d917b33 into pandas-dev:master Mar 26, 2020
@jreback
Copy link
Contributor

jreback commented Mar 26, 2020

thanks @pbourguignon

@pbourguignon pbourguignon deleted the rename-non-mapping-dict-fixture branch March 26, 2020 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Reshaping Concat, Merge/Join, Stack/Unstack, Explode Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fixture non_mapping_dict_subclass is wrongly named BUG: passing a non-dict mapping to pd.concat raises a TypeError
2 participants