Skip to content

Commit 0e53a4d

Browse files
committed
Restrcutred based on refactor and solved some typing errors
1 parent 5ec999e commit 0e53a4d

File tree

2 files changed

+21
-16
lines changed

2 files changed

+21
-16
lines changed

doc/source/whatsnew/v3.0.0.rst

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,6 @@ holding the data from each sheet.
3131
- The first dictionary is a dictionary of DataFrames corresponding to the data on each sheet
3232
- The second dictionary is a dictionary of DataFrames corresponding to the data in each table
3333

34-
.. _whatsnew_300.enhancements.enhancement1:
35-
36-
enhancement1
37-
^^^^^^^^^^^^
38-
3934
.. _whatsnew_300.enhancements.enhancement2:
4035

4136
enhancement2
@@ -56,9 +51,11 @@ Other enhancements
5651
- Users can globally disable any ``PerformanceWarning`` by setting the option ``mode.performance_warnings`` to ``False`` (:issue:`56920`)
5752
- :meth:`Styler.format_index_names` can now be used to format the index and column names (:issue:`48936` and :issue:`47489`)
5853
- :class:`.errors.DtypeWarning` improved to include column names when mixed data types are detected (:issue:`58174`)
54+
- :meth:`DataFrame.corrwith` now accepts ``min_periods`` as optional arguments, as in :meth:`DataFrame.corr` and :meth:`Series.corr` (:issue:`9490`)
5955
- :meth:`DataFrame.cummin`, :meth:`DataFrame.cummax`, :meth:`DataFrame.cumprod` and :meth:`DataFrame.cumsum` methods now have a ``numeric_only`` parameter (:issue:`53072`)
6056
- :meth:`DataFrame.fillna` and :meth:`Series.fillna` can now accept ``value=None``; for non-object dtype the corresponding NA value will be used (:issue:`57723`)
6157
- :meth:`Series.cummin` and :meth:`Series.cummax` now supports :class:`CategoricalDtype` (:issue:`52335`)
58+
- :meth:`Series.plot` now correctly handle the ``ylabel`` parameter for pie charts, allowing for explicit control over the y-axis label (:issue:`58239`)
6259

6360
.. ---------------------------------------------------------------------------
6461
.. _whatsnew_300.notable_bug_fixes:
@@ -237,6 +234,7 @@ Removal of prior version deprecations/changes
237234
- :meth:`SeriesGroupBy.agg` no longer pins the name of the group to the input passed to the provided ``func`` (:issue:`51703`)
238235
- All arguments except ``name`` in :meth:`Index.rename` are now keyword only (:issue:`56493`)
239236
- All arguments except the first ``path``-like argument in IO writers are now keyword only (:issue:`54229`)
237+
- Changed behavior of :meth:`Series.__getitem__` and :meth:`Series.__setitem__` to always treat integer keys as labels, never as positional, consistent with :class:`DataFrame` behavior (:issue:`50617`)
240238
- Disallow allowing logical operations (``||``, ``&``, ``^``) between pandas objects and dtype-less sequences (e.g. ``list``, ``tuple``); wrap the objects in :class:`Series`, :class:`Index`, or ``np.array`` first instead (:issue:`52264`)
241239
- Disallow automatic casting to object in :class:`Series` logical operations (``&``, ``^``, ``||``) between series with mismatched indexes and dtypes other than ``object`` or ``bool`` (:issue:`52538`)
242240
- Disallow calling :meth:`Series.replace` or :meth:`DataFrame.replace` without a ``value`` and with non-dict-like ``to_replace`` (:issue:`33302`)
@@ -350,13 +348,17 @@ Performance improvements
350348
- Performance improvement in :meth:`Index.join` by propagating cached attributes in cases where the result matches one of the inputs (:issue:`57023`)
351349
- Performance improvement in :meth:`Index.take` when ``indices`` is a full range indexer from zero to length of index (:issue:`56806`)
352350
- Performance improvement in :meth:`Index.to_frame` returning a :class:`RangeIndex` columns of a :class:`Index` when possible. (:issue:`58018`)
351+
- Performance improvement in :meth:`MultiIndex._engine` to use smaller dtypes if possible (:issue:`58411`)
353352
- Performance improvement in :meth:`MultiIndex.equals` for equal length indexes (:issue:`56990`)
354353
- Performance improvement in :meth:`MultiIndex.memory_usage` to ignore the index engine when it isn't already cached. (:issue:`58385`)
355354
- Performance improvement in :meth:`RangeIndex.__getitem__` with a boolean mask or integers returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57588`)
356355
- Performance improvement in :meth:`RangeIndex.append` when appending the same index (:issue:`57252`)
357356
- Performance improvement in :meth:`RangeIndex.argmin` and :meth:`RangeIndex.argmax` (:issue:`57823`)
358357
- Performance improvement in :meth:`RangeIndex.insert` returning a :class:`RangeIndex` instead of a :class:`Index` when the :class:`RangeIndex` is empty. (:issue:`57833`)
359358
- Performance improvement in :meth:`RangeIndex.round` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57824`)
359+
- Performance improvement in :meth:`RangeIndex.searchsorted` (:issue:`58376`)
360+
- Performance improvement in :meth:`RangeIndex.to_numpy` when specifying an ``na_value`` (:issue:`58376`)
361+
- Performance improvement in :meth:`RangeIndex.value_counts` (:issue:`58376`)
360362
- Performance improvement in :meth:`RangeIndex.join` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57651`, :issue:`57752`)
361363
- Performance improvement in :meth:`RangeIndex.reindex` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57647`, :issue:`57752`)
362364
- Performance improvement in :meth:`RangeIndex.take` returning a :class:`RangeIndex` instead of a :class:`Index` when possible. (:issue:`57445`, :issue:`57752`)
@@ -402,6 +404,7 @@ Numeric
402404

403405
Conversion
404406
^^^^^^^^^^
407+
- Bug in :meth:`DataFrame.astype` not casting ``values`` for Arrow-based dictionary dtype correctly (:issue:`58479`)
405408
- Bug in :meth:`DataFrame.update` bool dtype being converted to object (:issue:`55509`)
406409
- Bug in :meth:`Series.astype` might modify read-only array inplace when casting to a string dtype (:issue:`57212`)
407410
- Bug in :meth:`Series.reindex` not maintaining ``float32`` type when a ``reindex`` introduces a missing value (:issue:`45857`)
@@ -482,6 +485,7 @@ Styler
482485
Other
483486
^^^^^
484487
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
488+
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)
485489
- Bug in :func:`unique` on :class:`Index` not always returning :class:`Index` (:issue:`57043`)
486490
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which caused an exception when using NumPy attributes via ``@`` notation, e.g., ``df.eval("@np.floor(a)")``. (:issue:`58041`)
487491
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which did not allow to use ``tan`` function. (:issue:`55091`)
@@ -493,6 +497,7 @@ Other
493497
- Bug in :meth:`Series.rank` that doesn't preserve missing values for nullable integers when ``na_option='keep'``. (:issue:`56976`)
494498
- Bug in :meth:`Series.replace` and :meth:`DataFrame.replace` inconsistently replacing matching instances when ``regex=True`` and missing values are present. (:issue:`56599`)
495499
- Bug in Dataframe Interchange Protocol implementation was returning incorrect results for data buffers' associated dtype, for string and datetime columns (:issue:`54781`)
500+
- Bug in ``Series.list`` methods not preserving the original :class:`Index`. (:issue:`58425`)
496501

497502
.. ***DO NOT USE THIS SECTION***
498503

pandas/io/excel/_base.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -842,9 +842,9 @@ def parse(
842842
output[outputDict][asheetname] = DataFrame()
843843
continue
844844

845-
output = self.parse_data(
845+
output = self._parse_sheet(
846846
data=data,
847-
asheetname=asheetname,
847+
parse_area=asheetname,
848848
header=header,
849849
output=output,
850850
outputDict=outputDict,
@@ -899,9 +899,9 @@ def parse(
899899
output[outputDict][atablename] = DataFrame()
900900
continue
901901

902-
output = self.parse_data(
902+
output = self._parse_sheet(
903903
data=table_data,
904-
asheetname=atablename,
904+
parse_area=atablename,
905905
header=header,
906906
output=output,
907907
outputDict=outputDict,
@@ -942,11 +942,11 @@ def parse(
942942
else:
943943
return output["sheets"][last_sheetname]
944944

945-
def parse_data(
945+
def _parse_sheet(
946946
self,
947947
data: list,
948948
output: dict,
949-
asheetname: str | int | None = None,
949+
parse_area: str | int | None = None,
950950
header: int | Sequence[int] | None = 0,
951951
outputDict: str | None = None,
952952
names: SequenceNotStr[Hashable] | range | None = None,
@@ -1083,19 +1083,19 @@ def parse_data(
10831083
**kwds,
10841084
)
10851085

1086-
output[outputDict][asheetname] = parser.read(nrows=nrows)
1086+
output[outputDict][parse_area] = parser.read(nrows=nrows)
10871087

10881088
if header_names:
1089-
output[outputDict][asheetname].columns = output[outputDict][
1090-
asheetname
1089+
output[outputDict][parse_area].columns = output[outputDict][
1090+
parse_area
10911091
].columns.set_names(header_names)
10921092

10931093
except EmptyDataError:
10941094
# No Data, return an empty DataFrame
1095-
output[outputDict][asheetname] = DataFrame()
1095+
output[outputDict][parse_area] = DataFrame()
10961096

10971097
except Exception as err:
1098-
err.args = (f"{err.args[0]} (sheet: {asheetname})", *err.args[1:])
1098+
err.args = (f"{err.args[0]} (sheet: {parse_area})", *err.args[1:])
10991099
raise err
11001100

11011101
return output

0 commit comments

Comments
 (0)