Add files using upload-large-folder tool
Browse filesThis view is limited to 50 files because it contains too many changes.
See raw diff
- .gitattributes +2 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/__init__.py +27 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so +3 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so +3 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/indexing.pyi +17 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/json.cpython-310-x86_64-linux-gnu.so +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/json.pyi +23 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/missing.pyi +16 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/ops.pyi +51 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/sparse.cpython-310-x86_64-linux-gnu.so +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_api.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_arithmetic.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_constructors.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_cumulative.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_formats.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_iteration.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_logical_ops.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_missing.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_npfuncs.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_reductions.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_subclass.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_ufunc.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_unary.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_validate.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_delitem.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_get.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_indexing.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_take.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_where.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_xs.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_delitem.py +70 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_mask.py +69 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_set_value.py +45 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/__init__.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_add_prefix_suffix.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_align.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_asof.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_astype.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_autocorr.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_clip.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_combine.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_combine_first.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_convert_dtypes.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_copy.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_cov_corr.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_describe.cpython-310.pyc +0 -0
- llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_drop.cpython-310.pyc +0 -0
.gitattributes
CHANGED
@@ -193,3 +193,5 @@ llmeval-env/lib/python3.10/site-packages/numexpr/interpreter.cpython-310-x86_64-
|
|
193 |
llmeval-env/lib/python3.10/site-packages/nvidia/cufft/lib/libcufft.so.11 filter=lfs diff=lfs merge=lfs -text
|
194 |
llmeval-env/lib/python3.10/site-packages/pandas/_libs/interval.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
195 |
llmeval-env/lib/python3.10/site-packages/pandas/_libs/join.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
193 |
llmeval-env/lib/python3.10/site-packages/nvidia/cufft/lib/libcufft.so.11 filter=lfs diff=lfs merge=lfs -text
|
194 |
llmeval-env/lib/python3.10/site-packages/pandas/_libs/interval.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
195 |
llmeval-env/lib/python3.10/site-packages/pandas/_libs/join.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
196 |
+
llmeval-env/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
197 |
+
llmeval-env/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/__init__.py
ADDED
@@ -0,0 +1,27 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
__all__ = [
|
2 |
+
"NaT",
|
3 |
+
"NaTType",
|
4 |
+
"OutOfBoundsDatetime",
|
5 |
+
"Period",
|
6 |
+
"Timedelta",
|
7 |
+
"Timestamp",
|
8 |
+
"iNaT",
|
9 |
+
"Interval",
|
10 |
+
]
|
11 |
+
|
12 |
+
|
13 |
+
# Below imports needs to happen first to ensure pandas top level
|
14 |
+
# module gets monkeypatched with the pandas_datetime_CAPI
|
15 |
+
# see pandas_datetime_exec in pd_datetime.c
|
16 |
+
import pandas._libs.pandas_parser # isort: skip # type: ignore[reportUnusedImport]
|
17 |
+
import pandas._libs.pandas_datetime # noqa: F401 # isort: skip # type: ignore[reportUnusedImport]
|
18 |
+
from pandas._libs.interval import Interval
|
19 |
+
from pandas._libs.tslibs import (
|
20 |
+
NaT,
|
21 |
+
NaTType,
|
22 |
+
OutOfBoundsDatetime,
|
23 |
+
Period,
|
24 |
+
Timedelta,
|
25 |
+
Timestamp,
|
26 |
+
iNaT,
|
27 |
+
)
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/algos.cpython-310-x86_64-linux-gnu.so
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:6c90dd62bc6525e39bc76c8df9c7162cfc2cb1b371d00ff925cdfe7cd63ffdd5
|
3 |
+
size 2194056
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/groupby.cpython-310-x86_64-linux-gnu.so
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:724930f75dc3e6a3f7ae745ed008c7e3d5080a902a35d1843364531122789450
|
3 |
+
size 2622024
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/indexing.pyi
ADDED
@@ -0,0 +1,17 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import (
|
2 |
+
Generic,
|
3 |
+
TypeVar,
|
4 |
+
)
|
5 |
+
|
6 |
+
from pandas.core.indexing import IndexingMixin
|
7 |
+
|
8 |
+
_IndexingMixinT = TypeVar("_IndexingMixinT", bound=IndexingMixin)
|
9 |
+
|
10 |
+
class NDFrameIndexerBase(Generic[_IndexingMixinT]):
|
11 |
+
name: str
|
12 |
+
# in practice obj is either a DataFrame or a Series
|
13 |
+
obj: _IndexingMixinT
|
14 |
+
|
15 |
+
def __init__(self, name: str, obj: _IndexingMixinT) -> None: ...
|
16 |
+
@property
|
17 |
+
def ndim(self) -> int: ...
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/json.cpython-310-x86_64-linux-gnu.so
ADDED
Binary file (64.3 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/json.pyi
ADDED
@@ -0,0 +1,23 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import (
|
2 |
+
Any,
|
3 |
+
Callable,
|
4 |
+
)
|
5 |
+
|
6 |
+
def ujson_dumps(
|
7 |
+
obj: Any,
|
8 |
+
ensure_ascii: bool = ...,
|
9 |
+
double_precision: int = ...,
|
10 |
+
indent: int = ...,
|
11 |
+
orient: str = ...,
|
12 |
+
date_unit: str = ...,
|
13 |
+
iso_dates: bool = ...,
|
14 |
+
default_handler: None
|
15 |
+
| Callable[[Any], str | float | bool | list | dict | None] = ...,
|
16 |
+
) -> str: ...
|
17 |
+
def ujson_loads(
|
18 |
+
s: str,
|
19 |
+
precise_float: bool = ...,
|
20 |
+
numpy: bool = ...,
|
21 |
+
dtype: None = ...,
|
22 |
+
labelled: bool = ...,
|
23 |
+
) -> Any: ...
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/missing.pyi
ADDED
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
from numpy import typing as npt
|
3 |
+
|
4 |
+
class NAType:
|
5 |
+
def __new__(cls, *args, **kwargs): ...
|
6 |
+
|
7 |
+
NA: NAType
|
8 |
+
|
9 |
+
def is_matching_na(
|
10 |
+
left: object, right: object, nan_matches_none: bool = ...
|
11 |
+
) -> bool: ...
|
12 |
+
def isposinf_scalar(val: object) -> bool: ...
|
13 |
+
def isneginf_scalar(val: object) -> bool: ...
|
14 |
+
def checknull(val: object, inf_as_na: bool = ...) -> bool: ...
|
15 |
+
def isnaobj(arr: np.ndarray, inf_as_na: bool = ...) -> npt.NDArray[np.bool_]: ...
|
16 |
+
def is_numeric_na(values: np.ndarray) -> npt.NDArray[np.bool_]: ...
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/ops.pyi
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from typing import (
|
2 |
+
Any,
|
3 |
+
Callable,
|
4 |
+
Iterable,
|
5 |
+
Literal,
|
6 |
+
TypeAlias,
|
7 |
+
overload,
|
8 |
+
)
|
9 |
+
|
10 |
+
import numpy as np
|
11 |
+
|
12 |
+
from pandas._typing import npt
|
13 |
+
|
14 |
+
_BinOp: TypeAlias = Callable[[Any, Any], Any]
|
15 |
+
_BoolOp: TypeAlias = Callable[[Any, Any], bool]
|
16 |
+
|
17 |
+
def scalar_compare(
|
18 |
+
values: np.ndarray, # object[:]
|
19 |
+
val: object,
|
20 |
+
op: _BoolOp, # {operator.eq, operator.ne, ...}
|
21 |
+
) -> npt.NDArray[np.bool_]: ...
|
22 |
+
def vec_compare(
|
23 |
+
left: npt.NDArray[np.object_],
|
24 |
+
right: npt.NDArray[np.object_],
|
25 |
+
op: _BoolOp, # {operator.eq, operator.ne, ...}
|
26 |
+
) -> npt.NDArray[np.bool_]: ...
|
27 |
+
def scalar_binop(
|
28 |
+
values: np.ndarray, # object[:]
|
29 |
+
val: object,
|
30 |
+
op: _BinOp, # binary operator
|
31 |
+
) -> np.ndarray: ...
|
32 |
+
def vec_binop(
|
33 |
+
left: np.ndarray, # object[:]
|
34 |
+
right: np.ndarray, # object[:]
|
35 |
+
op: _BinOp, # binary operator
|
36 |
+
) -> np.ndarray: ...
|
37 |
+
@overload
|
38 |
+
def maybe_convert_bool(
|
39 |
+
arr: npt.NDArray[np.object_],
|
40 |
+
true_values: Iterable | None = None,
|
41 |
+
false_values: Iterable | None = None,
|
42 |
+
convert_to_masked_nullable: Literal[False] = ...,
|
43 |
+
) -> tuple[np.ndarray, None]: ...
|
44 |
+
@overload
|
45 |
+
def maybe_convert_bool(
|
46 |
+
arr: npt.NDArray[np.object_],
|
47 |
+
true_values: Iterable = ...,
|
48 |
+
false_values: Iterable = ...,
|
49 |
+
*,
|
50 |
+
convert_to_masked_nullable: Literal[True],
|
51 |
+
) -> tuple[np.ndarray, np.ndarray]: ...
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/parsers.cpython-310-x86_64-linux-gnu.so
ADDED
Binary file (595 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/sparse.cpython-310-x86_64-linux-gnu.so
ADDED
Binary file (989 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/_libs/writers.cpython-310-x86_64-linux-gnu.so
ADDED
Binary file (259 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (192 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_api.cpython-310.pyc
ADDED
Binary file (10.6 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_arithmetic.cpython-310.pyc
ADDED
Binary file (30.3 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_constructors.cpython-310.pyc
ADDED
Binary file (78.4 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_cumulative.cpython-310.pyc
ADDED
Binary file (4.45 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_formats.cpython-310.pyc
ADDED
Binary file (18.7 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_iteration.cpython-310.pyc
ADDED
Binary file (1.64 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_logical_ops.cpython-310.pyc
ADDED
Binary file (14.7 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_missing.cpython-310.pyc
ADDED
Binary file (3.71 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_npfuncs.cpython-310.pyc
ADDED
Binary file (1.76 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_reductions.cpython-310.pyc
ADDED
Binary file (6.82 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_subclass.cpython-310.pyc
ADDED
Binary file (3.58 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_ufunc.cpython-310.pyc
ADDED
Binary file (11.8 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_unary.cpython-310.pyc
ADDED
Binary file (1.95 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/__pycache__/test_validate.cpython-310.pyc
ADDED
Binary file (865 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_delitem.cpython-310.pyc
ADDED
Binary file (2.14 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_get.cpython-310.pyc
ADDED
Binary file (4.38 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_indexing.cpython-310.pyc
ADDED
Binary file (16.7 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_take.cpython-310.pyc
ADDED
Binary file (1.91 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_where.cpython-310.pyc
ADDED
Binary file (12.2 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/__pycache__/test_xs.cpython-310.pyc
ADDED
Binary file (3.21 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_delitem.py
ADDED
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import pytest
|
2 |
+
|
3 |
+
from pandas import (
|
4 |
+
Index,
|
5 |
+
Series,
|
6 |
+
date_range,
|
7 |
+
)
|
8 |
+
import pandas._testing as tm
|
9 |
+
|
10 |
+
|
11 |
+
class TestSeriesDelItem:
|
12 |
+
def test_delitem(self):
|
13 |
+
# GH#5542
|
14 |
+
# should delete the item inplace
|
15 |
+
s = Series(range(5))
|
16 |
+
del s[0]
|
17 |
+
|
18 |
+
expected = Series(range(1, 5), index=range(1, 5))
|
19 |
+
tm.assert_series_equal(s, expected)
|
20 |
+
|
21 |
+
del s[1]
|
22 |
+
expected = Series(range(2, 5), index=range(2, 5))
|
23 |
+
tm.assert_series_equal(s, expected)
|
24 |
+
|
25 |
+
# only 1 left, del, add, del
|
26 |
+
s = Series(1)
|
27 |
+
del s[0]
|
28 |
+
tm.assert_series_equal(s, Series(dtype="int64", index=Index([], dtype="int64")))
|
29 |
+
s[0] = 1
|
30 |
+
tm.assert_series_equal(s, Series(1))
|
31 |
+
del s[0]
|
32 |
+
tm.assert_series_equal(s, Series(dtype="int64", index=Index([], dtype="int64")))
|
33 |
+
|
34 |
+
def test_delitem_object_index(self, using_infer_string):
|
35 |
+
# Index(dtype=object)
|
36 |
+
dtype = "string[pyarrow_numpy]" if using_infer_string else object
|
37 |
+
s = Series(1, index=Index(["a"], dtype=dtype))
|
38 |
+
del s["a"]
|
39 |
+
tm.assert_series_equal(s, Series(dtype="int64", index=Index([], dtype=dtype)))
|
40 |
+
s["a"] = 1
|
41 |
+
tm.assert_series_equal(s, Series(1, index=Index(["a"], dtype=dtype)))
|
42 |
+
del s["a"]
|
43 |
+
tm.assert_series_equal(s, Series(dtype="int64", index=Index([], dtype=dtype)))
|
44 |
+
|
45 |
+
def test_delitem_missing_key(self):
|
46 |
+
# empty
|
47 |
+
s = Series(dtype=object)
|
48 |
+
|
49 |
+
with pytest.raises(KeyError, match=r"^0$"):
|
50 |
+
del s[0]
|
51 |
+
|
52 |
+
def test_delitem_extension_dtype(self):
|
53 |
+
# GH#40386
|
54 |
+
# DatetimeTZDtype
|
55 |
+
dti = date_range("2016-01-01", periods=3, tz="US/Pacific")
|
56 |
+
ser = Series(dti)
|
57 |
+
|
58 |
+
expected = ser[[0, 2]]
|
59 |
+
del ser[1]
|
60 |
+
assert ser.dtype == dti.dtype
|
61 |
+
tm.assert_series_equal(ser, expected)
|
62 |
+
|
63 |
+
# PeriodDtype
|
64 |
+
pi = dti.tz_localize(None).to_period("D")
|
65 |
+
ser = Series(pi)
|
66 |
+
|
67 |
+
expected = ser[:2]
|
68 |
+
del ser[2]
|
69 |
+
assert ser.dtype == pi.dtype
|
70 |
+
tm.assert_series_equal(ser, expected)
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_mask.py
ADDED
@@ -0,0 +1,69 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import numpy as np
|
2 |
+
import pytest
|
3 |
+
|
4 |
+
from pandas import Series
|
5 |
+
import pandas._testing as tm
|
6 |
+
|
7 |
+
|
8 |
+
def test_mask():
|
9 |
+
# compare with tested results in test_where
|
10 |
+
s = Series(np.random.default_rng(2).standard_normal(5))
|
11 |
+
cond = s > 0
|
12 |
+
|
13 |
+
rs = s.where(~cond, np.nan)
|
14 |
+
tm.assert_series_equal(rs, s.mask(cond))
|
15 |
+
|
16 |
+
rs = s.where(~cond)
|
17 |
+
rs2 = s.mask(cond)
|
18 |
+
tm.assert_series_equal(rs, rs2)
|
19 |
+
|
20 |
+
rs = s.where(~cond, -s)
|
21 |
+
rs2 = s.mask(cond, -s)
|
22 |
+
tm.assert_series_equal(rs, rs2)
|
23 |
+
|
24 |
+
cond = Series([True, False, False, True, False], index=s.index)
|
25 |
+
s2 = -(s.abs())
|
26 |
+
rs = s2.where(~cond[:3])
|
27 |
+
rs2 = s2.mask(cond[:3])
|
28 |
+
tm.assert_series_equal(rs, rs2)
|
29 |
+
|
30 |
+
rs = s2.where(~cond[:3], -s2)
|
31 |
+
rs2 = s2.mask(cond[:3], -s2)
|
32 |
+
tm.assert_series_equal(rs, rs2)
|
33 |
+
|
34 |
+
msg = "Array conditional must be same shape as self"
|
35 |
+
with pytest.raises(ValueError, match=msg):
|
36 |
+
s.mask(1)
|
37 |
+
with pytest.raises(ValueError, match=msg):
|
38 |
+
s.mask(cond[:3].values, -s)
|
39 |
+
|
40 |
+
|
41 |
+
def test_mask_casts():
|
42 |
+
# dtype changes
|
43 |
+
ser = Series([1, 2, 3, 4])
|
44 |
+
result = ser.mask(ser > 2, np.nan)
|
45 |
+
expected = Series([1, 2, np.nan, np.nan])
|
46 |
+
tm.assert_series_equal(result, expected)
|
47 |
+
|
48 |
+
|
49 |
+
def test_mask_casts2():
|
50 |
+
# see gh-21891
|
51 |
+
ser = Series([1, 2])
|
52 |
+
res = ser.mask([True, False])
|
53 |
+
|
54 |
+
exp = Series([np.nan, 2])
|
55 |
+
tm.assert_series_equal(res, exp)
|
56 |
+
|
57 |
+
|
58 |
+
def test_mask_inplace():
|
59 |
+
s = Series(np.random.default_rng(2).standard_normal(5))
|
60 |
+
cond = s > 0
|
61 |
+
|
62 |
+
rs = s.copy()
|
63 |
+
rs.mask(cond, inplace=True)
|
64 |
+
tm.assert_series_equal(rs.dropna(), s[~cond])
|
65 |
+
tm.assert_series_equal(rs, s.mask(cond))
|
66 |
+
|
67 |
+
rs = s.copy()
|
68 |
+
rs.mask(cond, -s, inplace=True)
|
69 |
+
tm.assert_series_equal(rs, s.mask(cond, -s))
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/indexing/test_set_value.py
ADDED
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
from datetime import datetime
|
2 |
+
|
3 |
+
import numpy as np
|
4 |
+
|
5 |
+
from pandas import (
|
6 |
+
DatetimeIndex,
|
7 |
+
Series,
|
8 |
+
)
|
9 |
+
import pandas._testing as tm
|
10 |
+
|
11 |
+
|
12 |
+
def test_series_set_value():
|
13 |
+
# GH#1561
|
14 |
+
|
15 |
+
dates = [datetime(2001, 1, 1), datetime(2001, 1, 2)]
|
16 |
+
index = DatetimeIndex(dates)
|
17 |
+
|
18 |
+
s = Series(dtype=object)
|
19 |
+
s._set_value(dates[0], 1.0)
|
20 |
+
s._set_value(dates[1], np.nan)
|
21 |
+
|
22 |
+
expected = Series([1.0, np.nan], index=index)
|
23 |
+
|
24 |
+
tm.assert_series_equal(s, expected)
|
25 |
+
|
26 |
+
|
27 |
+
def test_set_value_dt64(datetime_series):
|
28 |
+
idx = datetime_series.index[10]
|
29 |
+
res = datetime_series._set_value(idx, 0)
|
30 |
+
assert res is None
|
31 |
+
assert datetime_series[idx] == 0
|
32 |
+
|
33 |
+
|
34 |
+
def test_set_value_str_index(string_series):
|
35 |
+
# equiv
|
36 |
+
ser = string_series.copy()
|
37 |
+
res = ser._set_value("foobar", 0)
|
38 |
+
assert res is None
|
39 |
+
assert ser.index[-1] == "foobar"
|
40 |
+
assert ser["foobar"] == 0
|
41 |
+
|
42 |
+
ser2 = string_series.copy()
|
43 |
+
ser2.loc["foobar"] = 0
|
44 |
+
assert ser2.index[-1] == "foobar"
|
45 |
+
assert ser2["foobar"] == 0
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/__init__.cpython-310.pyc
ADDED
Binary file (430 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_add_prefix_suffix.cpython-310.pyc
ADDED
Binary file (2.01 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_align.cpython-310.pyc
ADDED
Binary file (6.14 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_asof.cpython-310.pyc
ADDED
Binary file (5.65 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_astype.cpython-310.pyc
ADDED
Binary file (22.6 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_autocorr.cpython-310.pyc
ADDED
Binary file (861 Bytes). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_clip.cpython-310.pyc
ADDED
Binary file (4.57 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_combine.cpython-310.pyc
ADDED
Binary file (1.41 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_combine_first.cpython-310.pyc
ADDED
Binary file (5.23 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_convert_dtypes.cpython-310.pyc
ADDED
Binary file (6.39 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_copy.cpython-310.pyc
ADDED
Binary file (2.26 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_cov_corr.cpython-310.pyc
ADDED
Binary file (4.64 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_describe.cpython-310.pyc
ADDED
Binary file (5.55 kB). View file
|
|
llmeval-env/lib/python3.10/site-packages/pandas/tests/series/methods/__pycache__/test_drop.cpython-310.pyc
ADDED
Binary file (3.26 kB). View file
|
|