-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
BUG: passing a non-dict mapping to pd.concat raises a TypeError #32953
Conversation
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.
Co-Authored-By: Simon Hawkins <[email protected]>
…parametrize construct
There was a problem hiding this 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.
doc/source/whatsnew/v1.1.0.rst
Outdated
@@ -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`) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
doc/source/whatsnew/v1.1.0.rst
Outdated
@@ -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`) |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
thanks @pbourguignon |
closes #32954
closes #32863
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff