repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_astype.py | pandas/tests/series/methods/test_astype.py | from datetime import (
datetime,
timedelta,
)
from importlib import reload
import string
import sys
import numpy as np
import pytest
from pandas._libs.tslibs import iNaT
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
from pandas import (
NA,
Categorical,
Catego... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_cov_corr.py | pandas/tests/series/methods/test_cov_corr.py | import math
import numpy as np
import pytest
import pandas as pd
from pandas import (
Series,
date_range,
isna,
)
import pandas._testing as tm
class TestSeriesCov:
def test_cov(self, datetime_series):
# full overlap
tm.assert_almost_equal(
datetime_series.cov(datetime_ser... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_add_prefix_suffix.py | pandas/tests/series/methods/test_add_prefix_suffix.py | import pytest
from pandas import Index
import pandas._testing as tm
def test_add_prefix_suffix(string_series):
with_prefix = string_series.add_prefix("foo#")
expected = Index([f"foo#{c}" for c in string_series.index])
tm.assert_index_equal(with_prefix.index, expected)
with_suffix = string_series.add... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_replace.py | pandas/tests/series/methods/test_replace.py | import re
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
import pandas._testing as tm
from pandas.core.arrays import IntervalArray
class TestSeriesReplace:
def test_replace_explicit_none(self):
# GH#36984 if the user explicitly passes value=None, give it ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_round.py | pandas/tests/series/methods/test_round.py | import numpy as np
import pytest
import pandas as pd
from pandas import Series
import pandas._testing as tm
class TestSeriesRound:
def test_round(self, datetime_series):
datetime_series.index.name = "index_name"
result = datetime_series.round(2)
expected = Series(
np.round(dat... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_tz_localize.py | pandas/tests/series/methods/test_tz_localize.py | from datetime import timezone
import pytest
from pandas._libs.tslibs import timezones
from pandas import (
DatetimeIndex,
NaT,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestTZLocalize:
def test_series_tz_localize_ambiguous_bool(self):
# make sure that we ar... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_combine_first.py | pandas/tests/series/methods/test_combine_first.py | from datetime import datetime
import numpy as np
from pandas.errors import Pandas4Warning
import pandas as pd
from pandas import (
Period,
Series,
date_range,
period_range,
to_datetime,
)
import pandas._testing as tm
class TestCombineFirst:
def test_combine_first_period_datetime(self):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_dropna.py | pandas/tests/series/methods/test_dropna.py | import numpy as np
import pytest
from pandas import (
DatetimeIndex,
IntervalIndex,
NaT,
Period,
Series,
Timestamp,
)
import pandas._testing as tm
class TestDropna:
def test_dropna_empty(self):
ser = Series([], dtype=object)
assert len(ser.dropna()) == 0
return_va... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_set_name.py | pandas/tests/series/methods/test_set_name.py | from datetime import datetime
from pandas import Series
class TestSetName:
def test_set_name(self):
ser = Series([1, 2, 3])
ser2 = ser._set_name("foo")
assert ser2.name == "foo"
assert ser.name is None
assert ser is not ser2
def test_set_name_attribute(self):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_diff.py | pandas/tests/series/methods/test_diff.py | import numpy as np
import pytest
from pandas import (
Series,
TimedeltaIndex,
date_range,
)
import pandas._testing as tm
class TestSeriesDiff:
def test_diff_series_requires_integer(self):
series = Series(np.random.default_rng(2).standard_normal(2))
with pytest.raises(ValueError, match... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_compare.py | pandas/tests/series/methods/test_compare.py | import numpy as np
import pytest
import pandas as pd
import pandas._testing as tm
def test_compare_axis(axis):
# GH#30429
s1 = pd.Series(["a", "b", "c"])
s2 = pd.Series(["x", "b", "z"])
result = s1.compare(s2, align_axis=axis)
if axis in (1, "columns"):
indices = pd.Index([0, 2])
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_map.py | pandas/tests/series/methods/test_map.py | from collections import (
Counter,
defaultdict,
)
from decimal import Decimal
import math
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
bdat... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_drop_duplicates.py | pandas/tests/series/methods/test_drop_duplicates.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
Series,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"keep, expected",
[
("first", Series([False, False, False, False, True, True, False])),
("last", Series([False, True, True, False, Fa... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_to_csv.py | pandas/tests/series/methods/test_to_csv.py | from datetime import datetime
from io import StringIO
import numpy as np
import pytest
import pandas as pd
from pandas import Series
import pandas._testing as tm
from pandas.io.common import get_handle
class TestSeriesToCSV:
def read_csv(self, path, **kwargs):
params = {"index_col": 0, "header": None}
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_get_numeric_data.py | pandas/tests/series/methods/test_get_numeric_data.py | from pandas import (
Series,
date_range,
)
import pandas._testing as tm
class TestGetNumericData:
def test_get_numeric_data_preserve_dtype(self):
# get the numeric data
obj = Series([1, 2, 3])
result = obj._get_numeric_data()
tm.assert_series_equal(result, obj)
# r... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_to_numpy.py | pandas/tests/series/methods/test_to_numpy.py | import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
NA,
Series,
Timedelta,
)
import pandas._testing as tm
@pytest.mark.parametrize("dtype", ["int64", "float64"])
def test_to_numpy_na_value(dtype):
# GH#48951
ser = Series([1, 2, NA, 4])
result = ser... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_isin.py | pandas/tests/series/methods/test_isin.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Series,
date_range,
)
import pandas._testing as tm
from pandas.core import algorithms
from pandas.core.arrays import PeriodArray
class TestSeriesIsIn:
def test_isin(self):
s = Series(["A", "B", "C", "a", "B", "B", "A", "C"]... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_sort_values.py | pandas/tests/series/methods/test_sort_values.py | import numpy as np
import pytest
from pandas import (
Categorical,
DataFrame,
Series,
)
import pandas._testing as tm
class TestSeriesSortValues:
def test_sort_values(self, datetime_series):
# check indexes are reordered corresponding with the values
ser = Series([3, 2, 4, 1], ["A", "B... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_dtypes.py | pandas/tests/series/methods/test_dtypes.py | import numpy as np
class TestSeriesDtypes:
def test_dtype(self, datetime_series):
assert datetime_series.dtype == np.dtype("float64")
assert datetime_series.dtypes == np.dtype("float64")
| python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_is_unique.py | pandas/tests/series/methods/test_is_unique.py | import numpy as np
import pytest
from pandas import Series
@pytest.mark.parametrize(
"data, expected",
[
(np.random.default_rng(2).integers(0, 10, size=1000), False),
(np.arange(1000), True),
([], True),
([np.nan], True),
(["foo", "bar", np.nan], True),
(["foo"... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_rank.py | pandas/tests/series/methods/test_rank.py | from itertools import chain
import operator
import numpy as np
import pytest
from pandas._libs.algos import (
Infinity,
NegInfinity,
)
import pandas.util._test_decorators as td
from pandas import (
NA,
NaT,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
from pandas.api.type... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_autocorr.py | pandas/tests/series/methods/test_autocorr.py | import numpy as np
class TestAutoCorr:
def test_autocorr(self, datetime_series):
# Just run the function
corr1 = datetime_series.autocorr()
# Now run it with the lag parameter
corr2 = datetime_series.autocorr(lag=1)
# corr() with lag needs Series of at least length 2
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_truncate.py | pandas/tests/series/methods/test_truncate.py | from datetime import datetime
import pytest
import pandas as pd
from pandas import (
Series,
date_range,
)
import pandas._testing as tm
class TestTruncate:
def test_truncate_datetimeindex_tz(self):
# GH 9243
idx = date_range("4/1/2005", "4/30/2005", freq="D", tz="US/Pacific")
s =... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_rename_axis.py | pandas/tests/series/methods/test_rename_axis.py | import pytest
from pandas import (
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
class TestSeriesRenameAxis:
def test_rename_axis_mapper(self):
# GH 19978
mi = MultiIndex.from_product([["a", "b", "c"], [1, 2]], names=["ll", "nn"])
ser = Series(list(range(len(mi))),... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_duplicated.py | pandas/tests/series/methods/test_duplicated.py | import numpy as np
import pytest
from pandas import (
NA,
Categorical,
Series,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"keep, expected",
[
("first", [False, False, True, False, True]),
("last", [True, True, False, False, False]),
(False, [True, True, True,... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/__init__.py | pandas/tests/series/methods/__init__.py | """
Test files dedicated to individual (stand-alone) Series methods
Ideally these files/tests should correspond 1-to-1 with tests.frame.methods
These may also present opportunities for sharing/de-duplicating test code.
"""
| python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_value_counts.py | pandas/tests/series/methods/test_value_counts.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
Index,
Series,
)
import pandas._testing as tm
class TestSeriesValueCounts:
def test_value_counts_datetime(self, unit):
# most dtypes are tested in tests/base
values = [
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_copy.py | pandas/tests/series/methods/test_copy.py | import numpy as np
import pytest
from pandas import (
Series,
Timestamp,
)
import pandas._testing as tm
class TestCopy:
@pytest.mark.parametrize("deep", ["default", None, False, True])
def test_copy(self, deep):
ser = Series(np.arange(10), dtype="float64")
# default deep is True
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_reindex.py | pandas/tests/series/methods/test_reindex.py | import numpy as np
import pytest
from pandas import (
NA,
Categorical,
Float64Dtype,
Index,
MultiIndex,
NaT,
Period,
PeriodIndex,
RangeIndex,
Series,
Timedelta,
Timestamp,
date_range,
isna,
)
import pandas._testing as tm
def test_reindex(datetime_series, string... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_describe.py | pandas/tests/series/methods/test_describe.py | import numpy as np
import pytest
from pandas.core.dtypes.common import (
is_complex_dtype,
is_extension_array_dtype,
)
from pandas import (
NA,
Period,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestSeriesDescribe:
def test_describe_ints(self):... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_values.py | pandas/tests/series/methods/test_values.py | import numpy as np
import pytest
from pandas import (
IntervalIndex,
Series,
period_range,
)
import pandas._testing as tm
class TestValues:
@pytest.mark.parametrize(
"data",
[
period_range("2000", periods=4),
IntervalIndex.from_breaks([1, 2, 3, 4]),
],
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_asof.py | pandas/tests/series/methods/test_asof.py | import numpy as np
import pytest
from pandas._libs.tslibs import IncompatibleFrequency
from pandas import (
DatetimeIndex,
PeriodIndex,
Series,
Timestamp,
date_range,
isna,
notna,
offsets,
period_range,
)
import pandas._testing as tm
class TestSeriesAsof:
def test_asof_nanose... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_reset_index.py | pandas/tests/series/methods/test_reset_index.py | from datetime import datetime
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
RangeIndex,
Series,
date_range,
option_context,
)
import pandas._testing as tm
class TestResetIndex:
def test_reset_index_dti_round_trip(self):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_pct_change.py | pandas/tests/series/methods/test_pct_change.py | import numpy as np
import pytest
from pandas import (
Series,
date_range,
)
import pandas._testing as tm
class TestSeriesPctChange:
def test_pct_change(self, datetime_series):
rs = datetime_series.pct_change()
tm.assert_series_equal(rs, datetime_series / datetime_series.shift(1) - 1)
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_between.py | pandas/tests/series/methods/test_between.py | import numpy as np
import pytest
from pandas import (
Series,
bdate_range,
date_range,
period_range,
)
import pandas._testing as tm
class TestBetween:
def test_between(self):
series = Series(date_range("1/1/2000", periods=10))
left, right = series[[2, 7]]
result = series.... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_is_monotonic.py | pandas/tests/series/methods/test_is_monotonic.py | import numpy as np
from pandas import (
Series,
date_range,
)
class TestIsMonotonic:
def test_is_monotonic_numeric(self):
ser = Series(np.random.default_rng(2).integers(0, 10, size=1000))
assert not ser.is_monotonic_increasing
ser = Series(np.arange(1000))
assert ser.is_mo... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_reindex_like.py | pandas/tests/series/methods/test_reindex_like.py | from datetime import datetime
import numpy as np
from pandas.errors import Pandas4Warning
from pandas import Series
import pandas._testing as tm
def test_reindex_like(datetime_series):
other = datetime_series[::2]
tm.assert_series_equal(
datetime_series.reindex(other.index), datetime_series.reindex... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_update.py | pandas/tests/series/methods/test_update.py | import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas import (
CategoricalDtype,
DataFrame,
NaT,
Series,
Timestamp,
)
import pandas._testing as tm
class TestUpdate:
def test_update(self):
s = Series([1.5, np.nan, 3.0, 4.0, np.nan])
s2 = Series... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_drop.py | pandas/tests/series/methods/test_drop.py | import pytest
from pandas import (
Index,
Series,
)
import pandas._testing as tm
from pandas.api.types import is_bool_dtype
@pytest.mark.parametrize(
"data, index, drop_labels, axis, expected_data, expected_index",
[
# Unique Index
([1, 2], ["one", "two"], ["two"], 0, [1], ["one"]),
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_clip.py | pandas/tests/series/methods/test_clip.py | from datetime import datetime
import numpy as np
import pytest
from pandas.errors import OutOfBoundsDatetime
import pandas as pd
from pandas import (
Series,
Timestamp,
isna,
notna,
)
import pandas._testing as tm
class TestSeriesClip:
def test_clip(self, datetime_series):
val = datetime... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_count.py | pandas/tests/series/methods/test_count.py | import numpy as np
from pandas import (
Categorical,
Series,
)
class TestSeriesCount:
def test_count(self, datetime_series):
assert datetime_series.count() == len(datetime_series)
datetime_series[::2] = np.nan
assert datetime_series.count() == np.isfinite(datetime_series).sum()
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_head_tail.py | pandas/tests/series/methods/test_head_tail.py | import pandas._testing as tm
def test_head_tail(string_series):
tm.assert_series_equal(string_series.head(), string_series[:5])
tm.assert_series_equal(string_series.head(0), string_series[0:0])
tm.assert_series_equal(string_series.tail(), string_series[-5:])
tm.assert_series_equal(string_series.tail(0... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_combine.py | pandas/tests/series/methods/test_combine.py | from pandas import (
NA,
Series,
)
import pandas._testing as tm
class TestCombine:
def test_combine_scalar(self):
# GH#21248
ser = Series([i * 10 for i in range(5)])
result = ser.combine(3, lambda x, y: x + y)
expected = Series([i * 10 + 3 for i in range(5)])
tm.ass... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_fillna.py | pandas/tests/series/methods/test_fillna.py | from datetime import (
datetime,
timedelta,
timezone,
)
import numpy as np
import pytest
from pandas import (
Categorical,
DataFrame,
DatetimeIndex,
NaT,
Period,
Series,
Timedelta,
Timestamp,
date_range,
isna,
timedelta_range,
)
import pandas._testing as tm
from... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_size.py | pandas/tests/series/methods/test_size.py | import pytest
from pandas import Series
@pytest.mark.parametrize(
"data, index, expected",
[
([1, 2, 3], None, 3),
({"a": 1, "b": 2, "c": 3}, None, 3),
([1, 2, 3], ["x", "y", "z"], 3),
([1, 2, 3, 4, 5], ["x", "y", "z", "w", "n"], 5),
([1, 2, 3, 4], ["x", "y", "z", "w"]... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_isna.py | pandas/tests/series/methods/test_isna.py | """
We also test Series.notna in this file.
"""
import numpy as np
from pandas import (
Period,
Series,
)
import pandas._testing as tm
class TestIsna:
def test_isna_period_dtype(self):
# GH#13737
ser = Series([Period("2011-01", freq="M"), Period("NaT", freq="M")])
expected = Ser... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_align.py | pandas/tests/series/methods/test_align.py | from datetime import timezone
import numpy as np
import pytest
import pandas as pd
from pandas import (
Series,
date_range,
period_range,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"first_slice,second_slice",
[
[[2, None], [None, -5]],
[[None, 0], [None, -5]],
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_to_dict.py | pandas/tests/series/methods/test_to_dict.py | import collections
import numpy as np
import pytest
from pandas import Series
import pandas._testing as tm
class TestSeriesToDict:
@pytest.mark.parametrize(
"mapping", (dict, collections.defaultdict(list), collections.OrderedDict)
)
def test_to_dict(self, mapping, datetime_series):
# GH#... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_info.py | pandas/tests/series/methods/test_info.py | from io import StringIO
from string import ascii_uppercase
import textwrap
import numpy as np
import pytest
from pandas._config import using_string_dtype
from pandas.compat import (
HAS_PYARROW,
PYPY,
)
from pandas import (
CategoricalIndex,
Index,
MultiIndex,
Series,
date_range,
)
def... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/methods/test_infer_objects.py | pandas/tests/series/methods/test_infer_objects.py | import numpy as np
from pandas import (
Series,
interval_range,
)
import pandas._testing as tm
class TestInferObjects:
def test_copy(self, index_or_series):
# GH#50096
# case where we don't need to do inference because it is already non-object
obj = index_or_series(np.array([1, 2,... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_datetime.py | pandas/tests/series/indexing/test_datetime.py | """
Also test support for datetime64[ns] in Series / DataFrame
"""
from datetime import (
datetime,
timedelta,
)
import re
from dateutil.tz import (
gettz,
tzutc,
)
import numpy as np
import pytest
from pandas._libs import index as libindex
import pandas as pd
from pandas import (
DataFrame,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_delitem.py | pandas/tests/series/indexing/test_delitem.py | import pytest
from pandas import (
Index,
Series,
date_range,
)
import pandas._testing as tm
class TestSeriesDelItem:
def test_delitem(self):
# GH#5542
# should delete the item inplace
s = Series(range(5))
del s[0]
expected = Series(range(1, 5), index=range(1,... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_indexing.py | pandas/tests/series/indexing/test_indexing.py | """test get/set & misc"""
from datetime import timedelta
import re
import numpy as np
import pytest
from pandas.errors import IndexingError
from pandas import (
NA,
DataFrame,
Index,
IndexSlice,
MultiIndex,
NaT,
Series,
Timedelta,
Timestamp,
concat,
date_range,
isna,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_take.py | pandas/tests/series/indexing/test_take.py | import pytest
import pandas as pd
from pandas import Series
import pandas._testing as tm
def test_take_validate_axis():
# GH#51022
ser = Series([-1, 5, 6, 2, 4])
msg = "No axis named foo for object type Series"
with pytest.raises(ValueError, match=msg):
ser.take([1, 2], axis="foo")
def tes... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_get.py | pandas/tests/series/indexing/test_get.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DatetimeIndex,
Index,
Series,
date_range,
)
import pandas._testing as tm
def test_get():
# GH 6383
s = Series(
np.array(
[
43,
48,
60,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_set_value.py | pandas/tests/series/indexing/test_set_value.py | from datetime import datetime
import numpy as np
from pandas import (
DatetimeIndex,
Index,
Series,
)
import pandas._testing as tm
def test_series_set_value(using_infer_string):
# GH#1561, GH#51363 as of 3.0 we do not do inference in Index.insert
dates = [datetime(2001, 1, 1), datetime(2001, 1,... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_mask.py | pandas/tests/series/indexing/test_mask.py | import numpy as np
import pytest
from pandas import Series
import pandas._testing as tm
def test_mask():
# compare with tested results in test_where
s = Series(np.random.default_rng(2).standard_normal(5))
cond = s > 0
rs = s.where(~cond, np.nan)
tm.assert_series_equal(rs, s.mask(cond))
rs =... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_getitem.py | pandas/tests/series/indexing/test_getitem.py | """
Series.__getitem__ test classes are organized by the type of key passed.
"""
from datetime import (
date,
datetime,
time,
)
import numpy as np
import pytest
from pandas._libs.tslibs import (
conversion,
timezones,
)
from pandas.compat.numpy import np_version_gt2
from pandas.errors import Pand... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/__init__.py | pandas/tests/series/indexing/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_setitem.py | pandas/tests/series/indexing/test_setitem.py | import contextlib
from datetime import (
date,
datetime,
)
from decimal import Decimal
import numpy as np
import pytest
from pandas.compat.numpy import np_version_gt2
from pandas.errors import IndexingError
from pandas.core.dtypes.common import is_list_like
from pandas import (
NA,
Categorical,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_where.py | pandas/tests/series/indexing/test_where.py | import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
import pandas as pd
from pandas import (
Series,
Timestamp,
date_range,
isna,
)
import pandas._testing as tm
def test_where_unsafe_int(any_signed_int_numpy_dtype):
s = Series(np.arange(10), dtype=any_signed_int_num... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/series/indexing/test_xs.py | pandas/tests/series/indexing/test_xs.py | import numpy as np
import pytest
from pandas import (
MultiIndex,
Series,
date_range,
)
import pandas._testing as tm
def test_xs_datetimelike_wrapping():
# GH#31630 a case where we shouldn't wrap datetime64 in Timestamp
arr = date_range("2016-01-01", periods=3)._data._ndarray
ser = Series(ar... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_pivot_multilevel.py | pandas/tests/reshape/test_pivot_multilevel.py | import numpy as np
import pytest
from pandas._libs import lib
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
import pandas._testing as tm
@pytest.mark.parametrize(
"input_index, input_columns, input_values, "
"expected_values, expected_columns, expected_index",
[
(
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_union_categoricals.py | pandas/tests/reshape/test_union_categoricals.py | import numpy as np
import pytest
from pandas.core.dtypes.concat import union_categoricals
import pandas as pd
from pandas import (
Categorical,
CategoricalIndex,
Series,
)
import pandas._testing as tm
class TestUnionCategoricals:
@pytest.mark.parametrize(
"a, b, combined",
[
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_pivot.py | pandas/tests/reshape/test_pivot.py | from datetime import (
date,
datetime,
timedelta,
)
from itertools import product
import re
import numpy as np
import pytest
from pandas._config import using_string_dtype
import pandas as pd
from pandas import (
ArrowDtype,
Categorical,
DataFrame,
Grouper,
Index,
MultiIndex,
S... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_crosstab.py | pandas/tests/reshape/test_crosstab.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
CategoricalDtype,
CategoricalIndex,
DataFrame,
Index,
MultiIndex,
Series,
crosstab,
)
import pandas._testing as tm
@pytest.fixture
def df():
df = DataFrame(
{
"A": [
"foo",
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_cut.py | pandas/tests/reshape/test_cut.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
DatetimeIndex,
Index,
Interval,
IntervalIndex,
Series,
TimedeltaIndex,
Timestamp,
cut,
date_range,
interval_range,
isna,
qcut,
timedelta_range,
to_datetime,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_from_dummies.py | pandas/tests/reshape/test_from_dummies.py | import numpy as np
import pytest
from pandas import (
DataFrame,
Series,
from_dummies,
get_dummies,
)
import pandas._testing as tm
@pytest.fixture
def dummies_basic():
return DataFrame(
{
"col1_a": [1, 0, 1],
"col1_b": [0, 1, 0],
"col2_a": [0, 1, 0],
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_get_dummies.py | pandas/tests/reshape/test_get_dummies.py | import re
import unicodedata
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_integer_dtype
import pandas as pd
from pandas import (
ArrowDtype,
Categorical,
CategoricalDtype,
CategoricalIndex,
DataFrame,
Index,
RangeInde... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_melt.py | pandas/tests/reshape/test_melt.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
date_range,
lreshape,
melt,
wide_to_long,
)
import pandas._testing as tm
@pytest.fixture
def df():
res = DataFrame(
np.random.default_rng(2).standard_normal((10, 4)),
col... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/__init__.py | pandas/tests/reshape/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/test_qcut.py | pandas/tests/reshape/test_qcut.py | import os
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DatetimeIndex,
Interval,
IntervalIndex,
NaT,
Series,
Timedelta,
TimedeltaIndex,
Timestamp,
cut,
date_range,
isna,
qcut,
timedelta_range,
)
import pandas._testing as ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_series.py | pandas/tests/reshape/concat/test_series.py | import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
concat,
date_range,
)
import pandas._testing as tm
class TestSeriesConcat:
@pytest.mark.parametrize("bool_dtype", [bool, "boolean"])
@pytest.mark.parametrize("dtype", [np.int... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_index.py | pandas/tests/reshape/concat/test_index.py | from copy import deepcopy
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
Series,
concat,
)
import pandas._testing as tm
class TestIndexConcat:
def test_concat_ignore_index(self, sort):
frame1 = DataFrame(
{"test1": ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_concat.py | pandas/tests/reshape/concat/test_concat.py | from collections import (
abc,
deque,
)
from collections.abc import Iterator
from datetime import datetime
from decimal import Decimal
import itertools
import numpy as np
import pytest
from pandas.errors import (
InvalidIndexError,
Pandas4Warning,
)
import pandas as pd
from pandas import (
DataFr... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_append_common.py | pandas/tests/reshape/concat/test_append_common.py | import zoneinfo
import numpy as np
import pytest
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
Series,
)
import pandas._testing as tm
@pytest.fixture(
params=list(
{
"bool": [True, False, True],
"int64": [1, 2, 3],
"float64": ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_sort.py | pandas/tests/reshape/concat/test_sort.py | import numpy as np
import pytest
import pandas as pd
from pandas import DataFrame
import pandas._testing as tm
class TestConcatSort:
def test_concat_sorts_columns(self, sort):
# GH-4588
df1 = DataFrame({"a": [1, 2], "b": [1, 2]}, columns=["b", "a"])
df2 = DataFrame({"a": [3, 4], "c": [5, ... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_append.py | pandas/tests/reshape/concat/test_append.py | import datetime as dt
from itertools import combinations
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
Timestamp,
concat,
isna,
)
import pandas._testing as tm
class TestAppend:
def test_append(self, sort, float_frame):... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_dataframe.py | pandas/tests/reshape/concat/test_dataframe.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
Index,
Series,
concat,
)
import pandas._testing as tm
class TestDataFrameConcat:
@pytest.mark.xfail(reason="GH#62888 the `mi[2][1] is 1` check fails")
def test_concat_multiindex_level_bool_and_numeric(self):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_datetimes.py | pandas/tests/reshape/concat/test_datetimes.py | import datetime as dt
from datetime import datetime
import dateutil
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timestamp,
concat,
date_range,
to_timedelta,
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/__init__.py | pandas/tests/reshape/concat/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_categorical.py | pandas/tests/reshape/concat/test_categorical.py | from datetime import datetime
import numpy as np
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Series,
)
import pandas._testing as tm
class TestCategoricalConcat:
def test_categorical... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_empty.py | pandas/tests/reshape/concat/test_empty.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
RangeIndex,
Series,
concat,
date_range,
)
import pandas._testing as tm
class TestEmptyConcat:
def test_handle_empty_objects(self, sort, using_infer_string):
df = DataFrame(
np.random.defau... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/concat/test_invalid.py | pandas/tests/reshape/concat/test_invalid.py | from io import StringIO
import numpy as np
import pytest
from pandas import (
DataFrame,
concat,
read_csv,
)
import pandas._testing as tm
class TestInvalidConcat:
@pytest.mark.parametrize("obj", [1, {}, [1, 2], (1, 2)])
def test_concat_invalid(self, obj):
# trying to concat an ndframe wi... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_multi.py | pandas/tests/reshape/merge/test_multi.py | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
Index,
MultiIndex,
RangeIndex,
Series,
Timestamp,
option_context,
)
import pandas._testing as tm
from pandas.core.reshape.concat import concat
from pandas.core.res... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge_cross.py | pandas/tests/reshape/merge/test_merge_cross.py | import pytest
from pandas import (
DataFrame,
Series,
)
import pandas._testing as tm
from pandas.core.reshape.merge import (
MergeError,
merge,
)
@pytest.mark.parametrize(
("input_col", "output_cols"), [("b", ["a", "b"]), ("a", ["a_x", "a_y"])]
)
def test_merge_cross(input_col, output_cols):
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_join.py | pandas/tests/reshape/merge/test_join.py | from datetime import datetime
import re
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Categorical,
DataFrame,
Index,
MultiIndex,
Series,
Timestamp,
bdate_range,
concat,
merge,
option_context,
)
import pandas... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge_asof.py | pandas/tests/reshape/merge/test_merge_asof.py | import datetime
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
Index,
Timedelta,
merge_asof,
option_context,
to_datetime,
)
import pandas._testing as tm
from pandas.core.reshape.merge import MergeError
class TestAsOfMerge:
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge_ordered.py | pandas/tests/reshape/merge/test_merge_ordered.py | import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
DataFrame,
merge_ordered,
)
import pandas._testing as tm
@pytest.fixture
def left():
return DataFrame({"key": ["a", "c", "e"], "lvalue": [1, 2.0, 3]})
@pytest.fixture
def right():
return DataFrame({"key": ["b", "c"... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge_index_as_string.py | pandas/tests/reshape/merge/test_merge_index_as_string.py | import numpy as np
import pytest
from pandas import DataFrame
import pandas._testing as tm
@pytest.fixture
def df1():
return DataFrame(
{
"outer": [1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 4],
"inner": [1, 2, 3, 1, 2, 3, 4, 1, 2, 1, 2],
"v1": np.linspace(0, 1, 11),
}
... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge_antijoin.py | pandas/tests/reshape/merge/test_merge_antijoin.py | import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
MultiIndex,
)
import pandas._testing as tm
from pandas.core.reshape.merge import merge
def test_merge_antijoin():
# GH#42916
left = DataFrame({"A": [1, 2, 3]}, index=["a", "... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/__init__.py | pandas/tests/reshape/merge/__init__.py | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false | |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/reshape/merge/test_merge.py | pandas/tests/reshape/merge/test_merge.py | from datetime import (
date,
datetime,
timedelta,
)
import re
import numpy as np
import pytest
from pandas.compat import PY314
from pandas.core.dtypes.common import (
is_object_dtype,
is_string_dtype,
)
from pandas.core.dtypes.dtypes import CategoricalDtype
import pandas as pd
from pandas import... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_indexing.py | pandas/tests/indexes/test_indexing.py | """
test_indexing tests the following Index methods:
__getitem__
get_loc
get_value
__contains__
take
where
get_indexer
get_indexer_for
slice_locs
asof_locs
The corresponding tests.indexes.[index_type].test_indexing files
contain tests for the corresponding methods specific to th... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_engines.py | pandas/tests/indexes/test_engines.py | import re
import numpy as np
import pytest
from pandas._libs import index as libindex
import pandas as pd
@pytest.fixture(
params=[
(libindex.Int64Engine, np.int64),
(libindex.Int32Engine, np.int32),
(libindex.Int16Engine, np.int16),
(libindex.Int8Engine, np.int8),
(libi... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_setops.py | pandas/tests/indexes/test_setops.py | """
The tests in this package are to ensure the proper resultant dtypes of
set operations.
"""
from datetime import datetime
import operator
import numpy as np
import pytest
from pandas._libs import lib
import pandas.util._test_decorators as td
from pandas.core.dtypes.cast import find_common_type
from pandas impor... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_numpy_compat.py | pandas/tests/indexes/test_numpy_compat.py | import numpy as np
import pytest
from pandas import (
BooleanDtype,
CategoricalIndex,
DatetimeIndex,
Index,
PeriodIndex,
TimedeltaIndex,
isna,
)
import pandas._testing as tm
from pandas.api.types import (
is_complex_dtype,
is_numeric_dtype,
)
from pandas.core.indexes.datetimelike im... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_common.py | pandas/tests/indexes/test_common.py | """
Collection of tests asserting things that should be true for
any index subclass except for MultiIndex. Makes use of the `index_flat`
fixture defined in pandas/conftest.py.
"""
from copy import (
copy,
deepcopy,
)
import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.errors... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/test_base.py | pandas/tests/indexes/test_base.py | from collections import defaultdict
from datetime import datetime
from functools import partial
import math
import operator
import re
import numpy as np
import pytest
from pandas.compat import IS64
from pandas.errors import InvalidIndexError
import pandas.util._test_decorators as td
from pandas.core.dtypes.common im... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | true |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/tests/indexes/conftest.py | pandas/tests/indexes/conftest.py | import numpy as np
import pytest
from pandas import (
Series,
array,
)
@pytest.fixture(params=[None, False])
def sort(request):
"""
Valid values for the 'sort' parameter used in the Index
setops methods (intersection, union, etc.)
Caution:
Don't confuse this one with the "sort" fixtu... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.