Skip to content

Commit c3ff1b6

Browse files
author
Matt Roeschke
committed
Merge remote-tracking branch 'upstream/master'
2 parents 6bb2d4c + c4489cb commit c3ff1b6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1442
-1366
lines changed

doc/redirects.csv

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1577,3 +1577,6 @@ generated/pandas.unique,../reference/api/pandas.unique
15771577
generated/pandas.util.hash_array,../reference/api/pandas.util.hash_array
15781578
generated/pandas.util.hash_pandas_object,../reference/api/pandas.util.hash_pandas_object
15791579
generated/pandas.wide_to_long,../reference/api/pandas.wide_to_long
1580+
1581+
# Cached searches
1582+
reference/api/pandas.DataFrame.from_csv,pandas.read_csv

doc/source/whatsnew/v1.0.0.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,10 @@ Deprecations
125125
Removed SparseSeries and SparseDataFrame
126126
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
127127

128-
``SparseSeries`` and ``SparseDataFrame`` have been removed (:issue:`28425`).
129-
We recommend using a ``Series`` or ``DataFrame`` with sparse values instead.
130-
See :ref:`sparse.migration` for help with migrating existing code.
128+
``SparseSeries``, ``SparseDataFrame`` and the ``DataFrame.to_sparse`` method
129+
have been removed (:issue:`28425`). We recommend using a ``Series`` or
130+
``DataFrame`` with sparse values instead. See :ref:`sparse.migration` for help
131+
with migrating existing code.
131132

132133
Removal of prior version deprecations/changes
133134
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -199,7 +200,7 @@ Timezones
199200
Numeric
200201
^^^^^^^
201202
- Bug in :meth:`DataFrame.quantile` with zero-column :class:`DataFrame` incorrectly raising (:issue:`23925`)
202-
-
203+
- :class:`DataFrame` inequality comparisons with object-dtype and ``complex`` entries failing to raise ``TypeError`` like their :class:`Series` counterparts (:issue:`28079`)
203204
-
204205

205206
Conversion

pandas/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
DataFrame,
115115
)
116116

117-
from pandas.core.sparse.api import SparseArray, SparseDtype
117+
from pandas.core.arrays.sparse import SparseArray, SparseDtype
118118

119119
from pandas.tseries.api import infer_freq
120120
from pandas.tseries import offsets

pandas/_libs/tslibs/conversion.pyx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ cdef _TSObject convert_str_to_tsobject(object ts, object tz, object unit,
519519
try:
520520
ts = parse_datetime_string(ts, dayfirst=dayfirst,
521521
yearfirst=yearfirst)
522-
except Exception:
522+
except (ValueError, OverflowError):
523523
raise ValueError("could not convert string to Timestamp")
524524

525525
return convert_to_tsobject(ts, tz, unit, dayfirst, yearfirst)

pandas/_libs/tslibs/nattype.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ class NaTType(_NaT):
551551
""")
552552
round = _make_nat_func('round', # noqa:E128
553553
"""
554-
Round the Timestamp to the specified resolution
554+
Round the Timestamp to the specified resolution.
555555
556556
Parameters
557557
----------
@@ -589,7 +589,7 @@ default 'raise'
589589
""")
590590
floor = _make_nat_func('floor', # noqa:E128
591591
"""
592-
return a new Timestamp floored to this resolution
592+
return a new Timestamp floored to this resolution.
593593
594594
Parameters
595595
----------
@@ -623,7 +623,7 @@ default 'raise'
623623
""")
624624
ceil = _make_nat_func('ceil', # noqa:E128
625625
"""
626-
return a new Timestamp ceiled to this resolution
626+
return a new Timestamp ceiled to this resolution.
627627
628628
Parameters
629629
----------
@@ -735,7 +735,7 @@ default 'raise'
735735
""")
736736
replace = _make_nat_func('replace', # noqa:E128
737737
"""
738-
implements datetime.replace, handles nanoseconds
738+
implements datetime.replace, handles nanoseconds.
739739
740740
Parameters
741741
----------

pandas/_libs/tslibs/parsing.pyx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,9 +309,9 @@ cdef parse_datetime_string_with_reso(date_string, freq=None, dayfirst=False,
309309
parsed, reso = dateutil_parse(date_string, _DEFAULT_DATETIME,
310310
dayfirst=dayfirst, yearfirst=yearfirst,
311311
ignoretz=False, tzinfos=None)
312-
except Exception as e:
312+
except (ValueError, OverflowError) as err:
313313
# TODO: allow raise of errors within instead
314-
raise DateParseError(e)
314+
raise DateParseError(err)
315315
if parsed is None:
316316
raise DateParseError("Could not parse {dstr}".format(dstr=date_string))
317317
return parsed, parsed, reso

pandas/_libs/tslibs/timedeltas.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,7 +1155,7 @@ cdef class _Timedelta(timedelta):
11551155
"""
11561156
Format Timedelta as ISO 8601 Duration like
11571157
``P[n]Y[n]M[n]DT[n]H[n]M[n]S``, where the ``[n]`` s are replaced by the
1158-
values. See https://en.wikipedia.org/wiki/ISO_8601#Durations
1158+
values. See https://en.wikipedia.org/wiki/ISO_8601#Durations.
11591159
11601160
.. versionadded:: 0.20.0
11611161
@@ -1319,7 +1319,7 @@ class Timedelta(_Timedelta):
13191319

13201320
def round(self, freq):
13211321
"""
1322-
Round the Timedelta to the specified resolution
1322+
Round the Timedelta to the specified resolution.
13231323
13241324
Parameters
13251325
----------
@@ -1337,7 +1337,7 @@ class Timedelta(_Timedelta):
13371337

13381338
def floor(self, freq):
13391339
"""
1340-
return a new Timedelta floored to this resolution
1340+
return a new Timedelta floored to this resolution.
13411341
13421342
Parameters
13431343
----------
@@ -1347,7 +1347,7 @@ class Timedelta(_Timedelta):
13471347

13481348
def ceil(self, freq):
13491349
"""
1350-
return a new Timedelta ceiled to this resolution
1350+
return a new Timedelta ceiled to this resolution.
13511351
13521352
Parameters
13531353
----------

pandas/_libs/tslibs/timestamps.pyx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class Timestamp(_Timestamp):
441441

442442
def round(self, freq, ambiguous='raise', nonexistent='raise'):
443443
"""
444-
Round the Timestamp to the specified resolution
444+
Round the Timestamp to the specified resolution.
445445
446446
Parameters
447447
----------
@@ -483,7 +483,7 @@ default 'raise'
483483

484484
def floor(self, freq, ambiguous='raise', nonexistent='raise'):
485485
"""
486-
return a new Timestamp floored to this resolution
486+
return a new Timestamp floored to this resolution.
487487
488488
Parameters
489489
----------
@@ -519,7 +519,7 @@ default 'raise'
519519

520520
def ceil(self, freq, ambiguous='raise', nonexistent='raise'):
521521
"""
522-
return a new Timestamp ceiled to this resolution
522+
return a new Timestamp ceiled to this resolution.
523523
524524
Parameters
525525
----------
@@ -556,7 +556,7 @@ default 'raise'
556556
@property
557557
def tz(self):
558558
"""
559-
Alias for tzinfo
559+
Alias for tzinfo.
560560
"""
561561
return self.tzinfo
562562

@@ -754,7 +754,7 @@ default 'raise'
754754
def resolution(self):
755755
"""
756756
Return resolution describing the smallest difference between two
757-
times that can be represented by Timestamp object_state
757+
times that can be represented by Timestamp object_state.
758758
"""
759759
# GH#21336, GH#21365
760760
return Timedelta(nanoseconds=1)
@@ -893,7 +893,7 @@ default 'raise'
893893
hour=None, minute=None, second=None, microsecond=None,
894894
nanosecond=None, tzinfo=object, fold=0):
895895
"""
896-
implements datetime.replace, handles nanoseconds
896+
implements datetime.replace, handles nanoseconds.
897897
898898
Parameters
899899
----------

pandas/core/apply.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ def wrap_results(self):
342342
results = self.results
343343

344344
# see if we can infer the results
345-
if len(results) > 0 and is_sequence(results[0]):
345+
if len(results) > 0 and 0 in results and is_sequence(results[0]):
346346

347347
return self.wrap_results_for_axis()
348348

pandas/core/arrays/datetimes.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1918,6 +1918,9 @@ def sequence_to_dt64ns(
19181918
tz = validate_tz_from_dtype(dtype, tz)
19191919

19201920
if isinstance(data, ABCIndexClass):
1921+
if data.nlevels > 1:
1922+
# Without this check, data._data below is None
1923+
raise TypeError("Cannot create a DatetimeArray from a MultiIndex.")
19211924
data = data._data
19221925

19231926
# By this point we are assured to have either a numpy array or Index

0 commit comments

Comments
 (0)