Skip to content

Series.rename now handles values by Series constructor #27975

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

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .clang-format
Empty file.
16 changes: 16 additions & 0 deletions doc/source/user_guide/visualization.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1628,3 +1628,19 @@ when plotting a large number of points.
:suppress:

plt.close('all')

Examples
~~~~~~~~

In order to understand how two variables are correlated, the best fit line
is a good way. You can use ``seaborn.lmplot()`` method that combines ``regplot()``
and ``FacetGrid`` to plot data and regression model fits across a FacetGrid.

.. ipython:: python
:suppress:

import seaborn as sns
df4 = pd.DataFrame({'a': np.random.randn(100) + 1, 'b': np.random.randn(100),
'c': np.random.randn(100) - 1}, columns=['a', 'b', 'c'])

sns.lmplot(x="a", y="b", data=df4)
8 changes: 3 additions & 5 deletions pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -4165,12 +4165,10 @@ def rename(self, index=None, **kwargs):
"""
kwargs["inplace"] = validate_bool_kwarg(kwargs.get("inplace", False), "inplace")

non_mapping = is_scalar(index) or (
is_list_like(index) and not is_dict_like(index)
)
if non_mapping:
if callable(index) or is_dict_like(index):
return super().rename(index=index, **kwargs)
else:
return self._set_name(index, inplace=kwargs.get("inplace"))
return super().rename(index=index, **kwargs)

@Substitution(**_shared_doc_kwargs)
@Appender(generic.NDFrame.reindex.__doc__)
Expand Down
4 changes: 4 additions & 0 deletions pandas/io/parquet.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,10 @@ def read_parquet(path, engine="auto", columns=None, **kwargs):
expected. A local file could be:
``file://localhost/path/to/table.parquet``.

A file path can also be a directory name that contains multiple(partitioned)
parquet files (in addition to single file path). A directory path could be:
``directory://usr/path/to/folder``.

If you want to pass in a path object, pandas accepts any
``os.PathLike``.

Expand Down