Skip to content

Commit ea903c9

Browse files
committed
Merge remote-tracking branch 'upstream/master' into test_coercion_typefix
2 parents 217adc8 + 8c5941c commit ea903c9

40 files changed

+688
-447
lines changed

doc/source/whatsnew/v0.25.2.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ I/O
6464

6565
- Fix regression in notebook display where <th> tags not used for :attr:`DataFrame.index` (:issue:`28204`).
6666
- Regression in :meth:`~DataFrame.to_csv` where writing a :class:`Series` or :class:`DataFrame` indexed by an :class:`IntervalIndex` would incorrectly raise a ``TypeError`` (:issue:`28210`)
67-
-
67+
- Fix :meth:`~DataFrame.to_csv` with ``ExtensionArray`` with list-like values (:issue:`28840`).
6868
-
6969

7070
Plotting

pandas/core/accessor.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ def _add_delegate_accessors(cls, delegate, accessors, typ, overwrite=False):
7171
accessors : string list of accessors to add
7272
typ : 'property' or 'method'
7373
overwrite : boolean, default False
74-
overwrite the method/property in the target class if it exists.
74+
Overwrite the method/property in the target class if it exists.
7575
"""
7676

7777
def _create_delegator_property(name):
@@ -118,12 +118,12 @@ def delegate_names(delegate, accessors, typ, overwrite=False):
118118
Parameters
119119
----------
120120
delegate : object
121-
the class to get methods/properties & doc-strings
121+
The class to get methods/properties & doc-strings.
122122
accessors : Sequence[str]
123-
List of accessor to add
123+
List of accessor to add.
124124
typ : {'property', 'method'}
125125
overwrite : boolean, default False
126-
overwrite the method/property in the target class if it exists
126+
Overwrite the method/property in the target class if it exists.
127127
128128
Returns
129129
-------
@@ -157,11 +157,11 @@ class CachedAccessor:
157157
Parameters
158158
----------
159159
name : str
160-
The namespace this will be accessed under, e.g. ``df.foo``
160+
The namespace this will be accessed under, e.g. ``df.foo``.
161161
accessor : cls
162162
The class with the extension methods. The class' __init__ method
163163
should expect one of a ``Series``, ``DataFrame`` or ``Index`` as
164-
the single argument ``data``
164+
the single argument ``data``.
165165
"""
166166

167167
def __init__(self, name, accessor):

pandas/core/arrays/base.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ def fillna(self, value=None, method=None, limit=None):
474474
method : {'backfill', 'bfill', 'pad', 'ffill', None}, default None
475475
Method to use for filling holes in reindexed Series
476476
pad / ffill: propagate last valid observation forward to next valid
477-
backfill / bfill: use NEXT valid observation to fill gap
477+
backfill / bfill: use NEXT valid observation to fill gap.
478478
limit : int, default None
479479
If method is specified, this is the maximum number of consecutive
480480
NaN values to forward/backward fill. In other words, if there is
@@ -485,7 +485,8 @@ def fillna(self, value=None, method=None, limit=None):
485485
486486
Returns
487487
-------
488-
filled : ExtensionArray with NA/NaN filled
488+
ExtensionArray
489+
With NA/NaN filled.
489490
"""
490491
value, method = validate_fillna_kwargs(value, method)
491492

@@ -539,13 +540,14 @@ def shift(self, periods: int = 1, fill_value: object = None) -> ABCExtensionArra
539540
540541
fill_value : object, optional
541542
The scalar value to use for newly introduced missing values.
542-
The default is ``self.dtype.na_value``
543+
The default is ``self.dtype.na_value``.
543544
544545
.. versionadded:: 0.24.0
545546
546547
Returns
547548
-------
548-
shifted : ExtensionArray
549+
ExtensionArray
550+
Shifted.
549551
550552
Notes
551553
-----
@@ -869,11 +871,12 @@ def view(self, dtype=None) -> Union[ABCExtensionArray, np.ndarray]:
869871
Parameters
870872
----------
871873
dtype : str, np.dtype, or ExtensionDtype, optional
872-
Default None
874+
Default None.
873875
874876
Returns
875877
-------
876878
ExtensionArray
879+
A view of the :class:`ExtensionArray`.
877880
"""
878881
# NB:
879882
# - This must return a *new* object referencing the same data, not self.

pandas/core/arrays/categorical.py

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -912,24 +912,26 @@ def rename_categories(self, new_categories, inplace=False):
912912
----------
913913
new_categories : list-like, dict-like or callable
914914
915-
* list-like: all items must be unique and the number of items in
916-
the new categories must match the existing number of categories.
915+
New categories which will replace old categories.
917916
918-
* dict-like: specifies a mapping from
919-
old categories to new. Categories not contained in the mapping
920-
are passed through and extra categories in the mapping are
921-
ignored.
917+
* list-like: all items must be unique and the number of items in
918+
the new categories must match the existing number of categories.
922919
923-
.. versionadded:: 0.21.0
920+
* dict-like: specifies a mapping from
921+
old categories to new. Categories not contained in the mapping
922+
are passed through and extra categories in the mapping are
923+
ignored.
924924
925-
* callable : a callable that is called on all items in the old
926-
categories and whose return values comprise the new categories.
925+
.. versionadded:: 0.21.0.
927926
928-
.. versionadded:: 0.23.0
927+
* callable : a callable that is called on all items in the old
928+
categories and whose return values comprise the new categories.
929+
930+
.. versionadded:: 0.23.0.
929931
930932
inplace : bool, default False
931-
Whether or not to rename the categories inplace or return a copy of
932-
this categorical with renamed categories.
933+
Whether or not to rename the categories inplace or return a copy of
934+
this categorical with renamed categories.
933935
934936
Returns
935937
-------

pandas/core/arrays/datetimelike.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class TimelikeOps:
207207
ambiguous times)
208208
- 'NaT' will return NaT where there are ambiguous times
209209
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
210-
times
210+
times.
211211
212212
.. versionadded:: 0.24.0
213213
@@ -223,7 +223,7 @@ class TimelikeOps:
223223
- 'NaT' will return NaT where there are nonexistent times
224224
- timedelta objects will shift nonexistent times by the timedelta
225225
- 'raise' will raise an NonExistentTimeError if there are
226-
nonexistent times
226+
nonexistent times.
227227
228228
.. versionadded:: 0.24.0
229229

pandas/core/arrays/datetimes.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -993,7 +993,7 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
993993
ambiguous times)
994994
- 'NaT' will return NaT where there are ambiguous times
995995
- 'raise' will raise an AmbiguousTimeError if there are ambiguous
996-
times
996+
times.
997997
998998
nonexistent : 'shift_forward', 'shift_backward, 'NaT', timedelta, \
999999
default 'raise'
@@ -1007,11 +1007,12 @@ def tz_localize(self, tz, ambiguous="raise", nonexistent="raise", errors=None):
10071007
- 'NaT' will return NaT where there are nonexistent times
10081008
- timedelta objects will shift nonexistent times by the timedelta
10091009
- 'raise' will raise an NonExistentTimeError if there are
1010-
nonexistent times
1010+
nonexistent times.
10111011
10121012
.. versionadded:: 0.24.0
10131013
10141014
errors : {'raise', 'coerce'}, default None
1015+
The method to handle errors:
10151016
10161017
- 'raise' will raise a NonExistentTimeError if a timestamp is not
10171018
valid in the specified time zone (e.g. due to a transition from
@@ -1871,7 +1872,7 @@ def sequence_to_dt64ns(
18711872
dayfirst : bool, default False
18721873
yearfirst : bool, default False
18731874
ambiguous : str, bool, or arraylike, default 'raise'
1874-
See pandas._libs.tslibs.conversion.tz_localize_to_utc
1875+
See pandas._libs.tslibs.conversion.tz_localize_to_utc.
18751876
int_as_wall_time : bool, default False
18761877
Whether to treat ints as wall time in specified timezone, or as
18771878
nanosecond-precision UNIX epoch (wall time in UTC).
@@ -2015,7 +2016,7 @@ def objects_to_datetime64ns(
20152016
dayfirst : bool
20162017
yearfirst : bool
20172018
utc : bool, default False
2018-
Whether to convert timezone-aware timestamps to UTC
2019+
Whether to convert timezone-aware timestamps to UTC.
20192020
errors : {'raise', 'ignore', 'coerce'}
20202021
allow_object : bool
20212022
Whether to return an object-dtype ndarray instead of raising if the

pandas/core/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ def to_numpy(self, dtype=None, copy=False):
906906
Parameters
907907
----------
908908
dtype : str or numpy.dtype, optional
909-
The dtype to pass to :meth:`numpy.asarray`
909+
The dtype to pass to :meth:`numpy.asarray`.
910910
copy : bool, default False
911911
Whether to ensure that the returned value is a not a view on
912912
another array. Note that ``copy=False`` does not *ensure* that

pandas/core/computation/eval.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,14 @@ def eval(
198198
<https://docs.python.org/3/reference/simple_stmts.html#simple-statements>`__,
199199
only Python `expressions
200200
<https://docs.python.org/3/reference/simple_stmts.html#expression-statements>`__.
201-
parser : string, default 'pandas', {'pandas', 'python'}
201+
parser : {'pandas', 'python'}, default 'pandas'
202202
The parser to use to construct the syntax tree from the expression. The
203203
default of ``'pandas'`` parses code slightly different than standard
204204
Python. Alternatively, you can parse an expression using the
205205
``'python'`` parser to retain strict Python semantics. See the
206206
:ref:`enhancing performance <enhancingperf.eval>` documentation for
207207
more details.
208-
engine : string or None, default 'numexpr', {'python', 'numexpr'}
208+
engine : {'python', 'numexpr'}, default 'numexpr'
209209
210210
The engine used to evaluate the expression. Supported engines are
211211

pandas/core/frame.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6238,7 +6238,7 @@ def unstack(self, level=-1, fill_value=None):
62386238
----------
62396239
level : int, str, or list of these, default -1 (last level)
62406240
Level(s) of index to unstack, can pass level name.
6241-
fill_value : int, string or dict
6241+
fill_value : int, str or dict
62426242
Replace NaN with this value if the unstack produces missing values.
62436243
62446244
Returns

0 commit comments

Comments
 (0)