Skip to content

Sync Fork from Upstream Repo #62

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
merged 3 commits into from
Feb 25, 2020
Merged
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
2 changes: 1 addition & 1 deletion ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ if [[ -z "$CHECK" || "$CHECK" == "doctests" ]]; then

MSG='Doctests generic.py' ; echo $MSG
pytest -q --doctest-modules pandas/core/generic.py \
-k"-_set_axis_name -_xs -describe -droplevel -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs -to_clipboard"
-k"-_set_axis_name -_xs -describe -groupby -interpolate -pct_change -pipe -reindex -reindex_axis -to_json -transpose -values -xs -to_clipboard"
RET=$(($RET + $?)) ; echo $MSG "DONE"

MSG='Doctests groupby.py' ; echo $MSG
Expand Down
2 changes: 1 addition & 1 deletion doc/source/whatsnew/v1.1.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Other enhancements

- :class:`Styler` may now render CSS more efficiently where multiple cells have the same styling (:issue:`30876`)
- When writing directly to a sqlite connection :func:`to_sql` now supports the ``multi`` method (:issue:`29921`)
-
- `OptionError` is now exposed in `pandas.errors` (:issue:`27553`)
-

.. ---------------------------------------------------------------------------
Expand Down
8 changes: 5 additions & 3 deletions pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,8 +777,10 @@ def searchsorted(self, value, side="left", sorter=None):
if isinstance(value, str):
try:
value = self._scalar_from_string(value)
except ValueError:
raise TypeError("searchsorted requires compatible dtype or scalar")
except ValueError as e:
raise TypeError(
"searchsorted requires compatible dtype or scalar"
) from e

elif is_valid_nat_for_dtype(value, self.dtype):
value = NaT
Expand Down Expand Up @@ -1041,7 +1043,7 @@ def _validate_frequency(cls, index, freq, **kwargs):
raise ValueError(
f"Inferred frequency {inferred} from passed values "
f"does not conform to passed frequency {freq.freqstr}"
)
) from e

# monotonicity/uniqueness properties are called via frequencies.infer_freq,
# see GH#23789
Expand Down
8 changes: 6 additions & 2 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -602,6 +602,10 @@ def droplevel(self: FrameOrSeries, level, axis=0) -> FrameOrSeries:
of levels.

axis : {0 or 'index', 1 or 'columns'}, default 0
Axis along which the level(s) is removed:

* 0 or 'index': remove level(s) in column.
* 1 or 'columns': remove level(s) in row.

Returns
-------
Expand All @@ -617,7 +621,7 @@ def droplevel(self: FrameOrSeries, level, axis=0) -> FrameOrSeries:
... ]).set_index([0, 1]).rename_axis(['a', 'b'])

>>> df.columns = pd.MultiIndex.from_tuples([
... ('c', 'e'), ('d', 'f')
... ('c', 'e'), ('d', 'f')
... ], names=['level_1', 'level_2'])

>>> df
Expand All @@ -636,7 +640,7 @@ def droplevel(self: FrameOrSeries, level, axis=0) -> FrameOrSeries:
6 7 8
10 11 12

>>> df.droplevel('level2', axis=1)
>>> df.droplevel('level_2', axis=1)
level_1 c d
a b
1 2 3 4
Expand Down
2 changes: 2 additions & 0 deletions pandas/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
Expose public exceptions & warnings
"""

from pandas._config.config import OptionError

from pandas._libs.tslibs import NullFrequencyError, OutOfBoundsDatetime


Expand Down
1 change: 1 addition & 0 deletions pandas/tests/test_errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"EmptyDataError",
"ParserWarning",
"MergeError",
"OptionError",
],
)
def test_exception_importable(exc):
Expand Down