Skip to content

Commit 3d873a0

Browse files
committed
Added test for covariance
2 parents 23eb852 + cf07e2c commit 3d873a0

File tree

16 files changed

+67
-60
lines changed

16 files changed

+67
-60
lines changed

.github/CODEOWNERS

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ doc/source/development @noatamir
1010

1111
# pandas
1212
pandas/_libs/ @WillAyd
13-
pandas/_libs/tslibs/* @MarcoGorelli
1413
pandas/_typing.py @Dr-Irv
1514
pandas/core/groupby/* @rhshadrach
16-
pandas/core/tools/datetimes.py @MarcoGorelli
1715
pandas/io/excel/* @rhshadrach
1816
pandas/io/formats/style.py @attack68
1917
pandas/io/formats/style_render.py @attack68

.github/workflows/wheels.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ jobs:
153153
run: echo "sdist_name=$(cd ./dist && ls -d */)" >> "$GITHUB_ENV"
154154

155155
- name: Build wheels
156-
uses: pypa/[email protected].1
156+
uses: pypa/[email protected].2
157157
with:
158158
package-dir: ./dist/${{ startsWith(matrix.buildplat[1], 'macosx') && env.sdist_name || needs.build_sdist.outputs.sdist_file }}
159159
env:

ci/meta.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,4 +89,3 @@ extra:
8989
- datapythonista
9090
- phofl
9191
- lithomas1
92-
- marcogorelli

doc/source/development/debugging_extensions.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ By default building pandas from source will generate a release build. To generat
2323

2424
.. note::
2525

26-
conda environments update CFLAGS/CPPFLAGS with flags that are geared towards generating releases. If using conda, you may need to set ``CFLAGS="$CFLAGS -O0"`` and ``CPPFLAGS="$CPPFLAGS -O0"`` to ensure optimizations are turned off for debugging
26+
conda environments update CFLAGS/CPPFLAGS with flags that are geared towards generating releases, and may work counter towards usage in a development environment. If using conda, you should unset these environment variables via ``export CFLAGS=`` and ``export CPPFLAGS=``
2727

2828
By specifying ``builddir="debug"`` all of the targets will be built and placed in the debug directory relative to the project root. This helps to keep your debug and release artifacts separate; you are of course able to choose a different directory name or omit altogether if you do not care to separate build types.
2929

doc/source/whatsnew/v3.0.0.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -825,6 +825,7 @@ Other
825825
- Bug in :class:`DataFrame` when passing a ``dict`` with a NA scalar and ``columns`` that would always return ``np.nan`` (:issue:`57205`)
826826
- Bug in :class:`Series` ignoring errors when trying to convert :class:`Series` input data to the given ``dtype`` (:issue:`60728`)
827827
- Bug in :func:`eval` on :class:`ExtensionArray` on including division ``/`` failed with a ``TypeError``. (:issue:`58748`)
828+
- Bug in :func:`eval` where method calls on binary operations like ``(x + y).dropna()`` would raise ``AttributeError: 'BinOp' object has no attribute 'value'`` (:issue:`61175`)
828829
- Bug in :func:`eval` where the names of the :class:`Series` were not preserved when using ``engine="numexpr"``. (:issue:`10239`)
829830
- Bug in :func:`eval` with ``engine="numexpr"`` returning unexpected result for float division. (:issue:`59736`)
830831
- Bug in :func:`to_numeric` raising ``TypeError`` when ``arg`` is a :class:`Timedelta` or :class:`Timestamp` scalar. (:issue:`59944`)
@@ -834,6 +835,7 @@ Other
834835
- Bug in :meth:`DataFrame.eval` and :meth:`DataFrame.query` which did not allow to use ``tan`` function. (:issue:`55091`)
835836
- Bug in :meth:`DataFrame.query` where using duplicate column names led to a ``TypeError``. (:issue:`59950`)
836837
- Bug in :meth:`DataFrame.query` which raised an exception or produced incorrect results when expressions contained backtick-quoted column names containing the hash character ``#``, backticks, or characters that fall outside the ASCII range (U+0001..U+007F). (:issue:`59285`) (:issue:`49633`)
838+
- Bug in :meth:`DataFrame.query` which raised an exception when querying integer column names using backticks. (:issue:`60494`)
837839
- Bug in :meth:`DataFrame.shift` where passing a ``freq`` on a DataFrame with no columns did not shift the index correctly. (:issue:`60102`)
838840
- Bug in :meth:`DataFrame.sort_index` when passing ``axis="columns"`` and ``ignore_index=True`` and ``ascending=False`` not returning a :class:`RangeIndex` columns (:issue:`57293`)
839841
- Bug in :meth:`DataFrame.transform` that was returning the wrong order unless the index was monotonically increasing. (:issue:`57069`)

pandas/core/computation/expr.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,11 @@ def visit_Attribute(self, node, **kwargs):
644644
ctx = node.ctx
645645
if isinstance(ctx, ast.Load):
646646
# resolve the value
647-
resolved = self.visit(value).value
647+
visited_value = self.visit(value)
648+
if hasattr(visited_value, "value"):
649+
resolved = visited_value.value
650+
else:
651+
resolved = visited_value(self.env)
648652
try:
649653
v = getattr(resolved, attr)
650654
name = self.env.add_tmp(v)

pandas/core/generic.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,6 @@ def _get_cleaned_column_resolvers(self) -> dict[Hashable, Series]:
612612
v, copy=False, index=self.index, name=k, dtype=dtype
613613
).__finalize__(self)
614614
for k, v, dtype in zip(self.columns, self._iter_column_arrays(), dtypes)
615-
if not isinstance(k, int)
616615
}
617616

618617
@final

pandas/core/missing.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -312,18 +312,9 @@ def get_interp_index(method, index: Index) -> Index:
312312
# create/use the index
313313
if method == "linear":
314314
# prior default
315-
from pandas import Index
316-
317-
if isinstance(index.dtype, DatetimeTZDtype) or lib.is_np_dtype(
318-
index.dtype, "mM"
319-
):
320-
# Convert datetime-like indexes to int64
321-
index = Index(index.view("i8"))
322-
323-
elif not is_numeric_dtype(index.dtype):
324-
# We keep behavior consistent with prior versions of pandas for
325-
# non-numeric, non-datetime indexes
326-
index = Index(range(len(index)))
315+
from pandas import RangeIndex
316+
317+
index = RangeIndex(len(index))
327318
else:
328319
methods = {"index", "values", "nearest", "time"}
329320
is_numeric_or_datetime = (

pandas/core/resample.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -897,17 +897,17 @@ def interpolate(
897897
to non-aligned timestamps, as in the following example:
898898
899899
>>> series.resample("400ms").interpolate("linear")
900-
2023-03-01 07:00:00.000 1.0
901-
2023-03-01 07:00:00.400 0.2
902-
2023-03-01 07:00:00.800 -0.6
903-
2023-03-01 07:00:01.200 -0.4
904-
2023-03-01 07:00:01.600 0.8
905-
2023-03-01 07:00:02.000 2.0
906-
2023-03-01 07:00:02.400 1.6
907-
2023-03-01 07:00:02.800 1.2
908-
2023-03-01 07:00:03.200 1.4
909-
2023-03-01 07:00:03.600 2.2
910-
2023-03-01 07:00:04.000 3.0
900+
2023-03-01 07:00:00.000 1.000000
901+
2023-03-01 07:00:00.400 0.333333
902+
2023-03-01 07:00:00.800 -0.333333
903+
2023-03-01 07:00:01.200 0.000000
904+
2023-03-01 07:00:01.600 1.000000
905+
2023-03-01 07:00:02.000 2.000000
906+
2023-03-01 07:00:02.400 1.666667
907+
2023-03-01 07:00:02.800 1.333333
908+
2023-03-01 07:00:03.200 1.666667
909+
2023-03-01 07:00:03.600 2.333333
910+
2023-03-01 07:00:04.000 3.000000
911911
Freq: 400ms, dtype: float64
912912
913913
Note that the series correctly decreases between two anchors

pandas/tests/computation/test_eval.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2006,3 +2006,24 @@ def test_eval_float_div_numexpr():
20062006
result = pd.eval("1 / 2", engine="numexpr")
20072007
expected = 0.5
20082008
assert result == expected
2009+
2010+
2011+
def test_method_calls_on_binop():
2012+
# GH 61175
2013+
x = Series([1, 2, 3, 5])
2014+
y = Series([2, 3, 4])
2015+
2016+
# Method call on binary operation result
2017+
result = pd.eval("(x + y).dropna()")
2018+
expected = (x + y).dropna()
2019+
tm.assert_series_equal(result, expected)
2020+
2021+
# Test with other binary operations
2022+
result = pd.eval("(x * y).dropna()")
2023+
expected = (x * y).dropna()
2024+
tm.assert_series_equal(result, expected)
2025+
2026+
# Test with method chaining
2027+
result = pd.eval("(x + y).dropna().reset_index(drop=True)")
2028+
expected = (x + y).dropna().reset_index(drop=True)
2029+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)