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/indexes/__init__.py
pandas/tests/indexes/__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/indexes/test_datetimelike.py
pandas/tests/indexes/test_datetimelike.py
"""generic datetimelike tests""" import numpy as np import pytest import pandas as pd import pandas._testing as tm class TestDatetimeLike: @pytest.fixture( params=[ pd.period_range("20130101", periods=5, freq="D"), pd.TimedeltaIndex( [ "0 days ...
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_frozen.py
pandas/tests/indexes/test_frozen.py
import re import pytest from pandas.core.indexes.frozen import FrozenList @pytest.fixture def lst(): return [1, 2, 3, 4, 5] @pytest.fixture def container(lst): return FrozenList(lst) @pytest.fixture def unicode_container(): return FrozenList(["\u05d0", "\u05d1", "c"]) class TestFrozenList: 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/indexes/test_subclass.py
pandas/tests/indexes/test_subclass.py
""" Tests involving custom Index subclasses """ import numpy as np from pandas import ( DataFrame, Index, ) import pandas._testing as tm class CustomIndex(Index): def __new__(cls, data, name=None): # assert that this index class cannot hold strings if any(isinstance(val, str) for val in ...
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_old_base.py
pandas/tests/indexes/test_old_base.py
from __future__ import annotations from datetime import datetime import weakref import numpy as np import pytest from pandas._libs.tslibs import Timestamp from pandas.errors import Pandas4Warning from pandas.core.dtypes.common import ( is_integer_dtype, is_numeric_dtype, ) from pandas.core.dtypes.dtypes imp...
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_index_new.py
pandas/tests/indexes/test_index_new.py
""" Tests for the Index constructor conducting inference. """ from datetime import ( datetime, timedelta, timezone, ) from decimal import Decimal import numpy as np import pytest from pandas._libs.tslibs.timezones import maybe_get_tz from pandas import ( NA, Categorical, CategoricalIndex, ...
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_any_index.py
pandas/tests/indexes/test_any_index.py
""" Tests that can be parametrized over _any_ Index object. """ import re import numpy as np import pytest from pandas.errors import InvalidIndexError from pandas import StringDtype import pandas._testing as tm def test_boolean_context_compat(index): # GH#7897 with pytest.raises(ValueError, match="The tru...
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/string/test_indexing.py
pandas/tests/indexes/string/test_indexing.py
import numpy as np import pytest import pandas as pd from pandas import Index import pandas._testing as tm def _isnan(val): try: return val is not pd.NA and np.isnan(val) except TypeError: return False def _equivalent_na(dtype, null): if dtype.na_value is pd.NA and null is pd.NA: ...
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/string/test_astype.py
pandas/tests/indexes/string/test_astype.py
from pandas import ( Index, Series, ) import pandas._testing as tm def test_astype_str_from_bytes(): # https://github.com/pandas-dev/pandas/issues/38607 # GH#49658 pre-2.0 Index called .values.astype(str) here, which effectively # did a .decode() on the bytes object. In 2.0 we go through # ...
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/string/__init__.py
pandas/tests/indexes/string/__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/indexes/period/test_join.py
pandas/tests/indexes/period/test_join.py
import numpy as np from pandas import ( DataFrame, Index, PeriodIndex, date_range, period_range, ) import pandas._testing as tm class TestJoin: def test_join_outer_indexer(self): pi = period_range("1/1/2000", "1/20/2000", freq="D") result = pi._outer_indexer(pi) tm.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/indexes/period/test_indexing.py
pandas/tests/indexes/period/test_indexing.py
from datetime import datetime import re import numpy as np import pytest from pandas._libs.tslibs import period as libperiod from pandas.errors import InvalidIndexError import pandas as pd from pandas import ( DatetimeIndex, NaT, Period, PeriodIndex, Series, Timedelta, date_range, not...
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/period/test_searchsorted.py
pandas/tests/indexes/period/test_searchsorted.py
import numpy as np import pytest from pandas._libs.tslibs import IncompatibleFrequency from pandas import ( NaT, Period, PeriodIndex, ) import pandas._testing as tm class TestSearchsorted: @pytest.mark.parametrize("freq", ["D", "2D"]) def test_searchsorted(self, freq): pidx = PeriodIndex...
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/period/test_setops.py
pandas/tests/indexes/period/test_setops.py
import numpy as np import pytest import pandas as pd from pandas import ( PeriodIndex, date_range, period_range, ) import pandas._testing as tm def _permute(obj): return obj.take(np.random.default_rng(2).permutation(len(obj))) class TestPeriodIndex: def test_union(self, sort): # union ...
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/period/test_tools.py
pandas/tests/indexes/period/test_tools.py
import numpy as np import pytest from pandas import ( Period, PeriodIndex, period_range, ) import pandas._testing as tm class TestPeriodRepresentation: """ Wish to match NumPy units """ @pytest.mark.parametrize( "freq, base_date", [ ("W-THU", "1970-01-01"), ...
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/period/test_freq_attr.py
pandas/tests/indexes/period/test_freq_attr.py
import pytest from pandas import ( offsets, period_range, ) import pandas._testing as tm class TestFreq: def test_freq_setter_deprecated(self): # GH#20678 idx = period_range("2018Q1", periods=4, freq="Q") # no warning for getter with tm.assert_produces_warning(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/indexes/period/test_constructors.py
pandas/tests/indexes/period/test_constructors.py
import numpy as np import pytest from pandas._libs.tslibs.period import IncompatibleFrequency from pandas.errors import Pandas4Warning from pandas.core.dtypes.dtypes import PeriodDtype from pandas import ( Index, NaT, Period, PeriodIndex, Series, date_range, offsets, period_range, ) i...
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/period/test_period_range.py
pandas/tests/indexes/period/test_period_range.py
import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas import ( NaT, Period, PeriodIndex, date_range, period_range, ) import pandas._testing as tm class TestPeriodRangeKeywords: def test_required_arguments(self): msg = ( "Of the three parame...
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/period/test_resolution.py
pandas/tests/indexes/period/test_resolution.py
import pytest import pandas as pd class TestResolution: @pytest.mark.parametrize( "freq,expected", [ ("Y", "year"), ("Q", "quarter"), ("M", "month"), ("D", "day"), ("h", "hour"), ("min", "minute"), ("s", "second")...
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/period/test_monotonic.py
pandas/tests/indexes/period/test_monotonic.py
from pandas import ( Period, PeriodIndex, ) def test_is_monotonic_increasing(): # GH#17717 p0 = Period("2017-09-01") p1 = Period("2017-09-02") p2 = Period("2017-09-03") idx_inc0 = PeriodIndex([p0, p1, p2]) idx_inc1 = PeriodIndex([p0, p1, p1]) idx_dec0 = PeriodIndex([p2, p1, p0]) ...
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/period/test_formats.py
pandas/tests/indexes/period/test_formats.py
import numpy as np import pytest import pandas as pd from pandas import ( PeriodIndex, Series, ) import pandas._testing as tm def test_get_values_for_csv(): index = PeriodIndex(["2017-01-01", "2017-01-02", "2017-01-03"], freq="D") # First, with no arguments. expected = np.array(["2017-01-01", "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/indexes/period/test_scalar_compat.py
pandas/tests/indexes/period/test_scalar_compat.py
"""Tests for PeriodIndex behaving like a vectorized Period scalar""" import pytest from pandas import ( Timedelta, date_range, period_range, ) import pandas._testing as tm class TestPeriodIndexOps: def test_start_time(self): # GH#17157 index = period_range(freq="M", start="2016-01-01...
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/period/test_partial_slicing.py
pandas/tests/indexes/period/test_partial_slicing.py
import numpy as np import pytest from pandas import ( DataFrame, PeriodIndex, Series, date_range, period_range, ) import pandas._testing as tm class TestPeriodIndex: def test_getitem_periodindex_duplicates_string_slice(self): # monotonic idx = PeriodIndex([2000, 2007, 2007, 20...
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/period/__init__.py
pandas/tests/indexes/period/__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/indexes/period/test_pickle.py
pandas/tests/indexes/period/test_pickle.py
import numpy as np import pytest from pandas import ( NaT, PeriodIndex, period_range, ) import pandas._testing as tm from pandas.tseries import offsets class TestPickle: @pytest.mark.parametrize("freq", ["D", "M", "Y"]) def test_pickle_round_trip(self, freq, tmp_path): idx = PeriodIndex(...
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/period/test_period.py
pandas/tests/indexes/period/test_period.py
import numpy as np import pytest from pandas.errors import IncompatibleFrequency from pandas import ( Index, NaT, Period, PeriodIndex, Series, date_range, offsets, period_range, ) import pandas._testing as tm class TestPeriodIndex: def test_view_asi8(self): idx = PeriodIn...
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/period/methods/test_asfreq.py
pandas/tests/indexes/period/methods/test_asfreq.py
import re import pytest from pandas import ( PeriodIndex, Series, period_range, ) import pandas._testing as tm from pandas.tseries import offsets class TestPeriodIndex: def test_asfreq(self): pi1 = period_range(freq="Y", start="1/1/2001", end="1/1/2001") pi2 = period_range(freq="Q",...
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/period/methods/test_insert.py
pandas/tests/indexes/period/methods/test_insert.py
import numpy as np import pytest from pandas import ( NaT, PeriodIndex, period_range, ) import pandas._testing as tm class TestInsert: @pytest.mark.parametrize("na", [np.nan, NaT, None]) def test_insert(self, na): # GH#18295 (test missing) expected = PeriodIndex(["2017Q1", NaT, "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/indexes/period/methods/test_factorize.py
pandas/tests/indexes/period/methods/test_factorize.py
import numpy as np from pandas import PeriodIndex import pandas._testing as tm class TestFactorize: def test_factorize_period(self): idx1 = PeriodIndex( ["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"], freq="M", ) exp_arr = np.array([0, 0, 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/indexes/period/methods/test_repeat.py
pandas/tests/indexes/period/methods/test_repeat.py
import numpy as np import pytest from pandas import ( PeriodIndex, period_range, ) import pandas._testing as tm class TestRepeat: @pytest.mark.parametrize("use_numpy", [True, False]) @pytest.mark.parametrize( "index", [ period_range("2000-01-01", periods=3, freq="D"), ...
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/period/methods/test_astype.py
pandas/tests/indexes/period/methods/test_astype.py
import numpy as np import pytest from pandas import ( CategoricalIndex, DatetimeIndex, Index, NaT, Period, PeriodIndex, period_range, ) import pandas._testing as tm class TestPeriodIndexAsType: @pytest.mark.parametrize("dtype", [float, "timedelta64", "timedelta64[ns]"]) def test_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/indexes/period/methods/test_is_full.py
pandas/tests/indexes/period/methods/test_is_full.py
import pytest from pandas import PeriodIndex def test_is_full(): index = PeriodIndex([2005, 2007, 2009], freq="Y") assert not index.is_full index = PeriodIndex([2005, 2006, 2007], freq="Y") assert index.is_full index = PeriodIndex([2005, 2005, 2007], freq="Y") assert not index.is_full ...
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/period/methods/test_shift.py
pandas/tests/indexes/period/methods/test_shift.py
import numpy as np import pytest from pandas import ( PeriodIndex, period_range, ) import pandas._testing as tm class TestPeriodIndexShift: # --------------------------------------------------------------- # PeriodIndex.shift is used by __add__ and __sub__ def test_pi_shift_ndarray(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/indexes/period/methods/__init__.py
pandas/tests/indexes/period/methods/__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/indexes/period/methods/test_to_timestamp.py
pandas/tests/indexes/period/methods/test_to_timestamp.py
from datetime import datetime import numpy as np import pytest from pandas import ( DatetimeIndex, NaT, PeriodIndex, Timedelta, Timestamp, date_range, period_range, ) import pandas._testing as tm class TestToTimestamp: def test_to_timestamp_non_contiguous(self): # GH#44100 ...
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/period/methods/test_fillna.py
pandas/tests/indexes/period/methods/test_fillna.py
from pandas import ( Index, NaT, Period, PeriodIndex, ) import pandas._testing as tm class TestFillNA: def test_fillna_period(self): # GH#11343 idx = PeriodIndex(["2011-01-01 09:00", NaT, "2011-01-01 11:00"], freq="h") exp = PeriodIndex( ["2011-01-01 09:00", "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/indexes/datetimelike_/test_equals.py
pandas/tests/indexes/datetimelike_/test_equals.py
""" Tests shared for DatetimeIndex/TimedeltaIndex/PeriodIndex """ from datetime import ( datetime, timedelta, ) import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, DatetimeIndex, Index, PeriodIndex, TimedeltaIndex, date_range, period_range, ...
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/datetimelike_/test_indexing.py
pandas/tests/indexes/datetimelike_/test_indexing.py
import numpy as np import pytest import pandas as pd from pandas import ( DatetimeIndex, Index, ) import pandas._testing as tm dtlike_dtypes = [ np.dtype("timedelta64[ns]"), np.dtype("datetime64[ns]"), pd.DatetimeTZDtype("ns", "Asia/Tokyo"), pd.PeriodDtype("ns"), ] @pytest.mark.parametrize("...
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/datetimelike_/test_drop_duplicates.py
pandas/tests/indexes/datetimelike_/test_drop_duplicates.py
import numpy as np import pytest from pandas import ( PeriodIndex, Series, date_range, period_range, timedelta_range, ) import pandas._testing as tm class DropDuplicates: def test_drop_duplicates_metadata(self, idx): # GH#10115 result = idx.drop_duplicates() tm.assert_...
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/datetimelike_/test_sort_values.py
pandas/tests/indexes/datetimelike_/test_sort_values.py
import numpy as np import pytest from pandas import ( DatetimeIndex, Index, NaT, PeriodIndex, TimedeltaIndex, timedelta_range, ) import pandas._testing as tm def check_freq_ascending(ordered, orig, ascending): """ Check the expected freq on a PeriodIndex/DatetimeIndex/TimedeltaIndex ...
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/datetimelike_/test_nat.py
pandas/tests/indexes/datetimelike_/test_nat.py
import numpy as np import pytest from pandas import ( DatetimeIndex, NaT, PeriodIndex, TimedeltaIndex, ) import pandas._testing as tm @pytest.mark.parametrize( "index_without_na", [ TimedeltaIndex(["1 days", "2 days"]), PeriodIndex(["2011-01-01", "2011-01-02"], freq="D"), ...
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/datetimelike_/__init__.py
pandas/tests/indexes/datetimelike_/__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/indexes/datetimelike_/test_value_counts.py
pandas/tests/indexes/datetimelike_/test_value_counts.py
import numpy as np from pandas import ( DatetimeIndex, NaT, PeriodIndex, Series, TimedeltaIndex, date_range, period_range, timedelta_range, ) import pandas._testing as tm class TestValueCounts: # GH#7735 def test_value_counts_unique_datetimeindex(self, tz_naive_fixture): ...
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/datetimelike_/test_is_monotonic.py
pandas/tests/indexes/datetimelike_/test_is_monotonic.py
from pandas import ( Index, NaT, date_range, ) def test_is_monotonic_with_nat(): # GH#31437 # PeriodIndex.is_monotonic_increasing should behave analogously to DatetimeIndex, # in particular never be monotonic when we have NaT dti = date_range("2016-01-01", periods=3) pi = dti.to_perio...
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/base_class/test_reshape.py
pandas/tests/indexes/base_class/test_reshape.py
""" Tests for ndarray-like method on the base Index class """ import numpy as np import pytest from pandas import Index import pandas._testing as tm class TestReshape: def test_repeat(self): repeats = 2 index = Index([1, 2, 3]) expected = Index([1, 1, 2, 2, 3, 3]) result = 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/indexes/base_class/test_indexing.py
pandas/tests/indexes/base_class/test_indexing.py
import numpy as np import pytest from pandas._libs import index as libindex import pandas as pd from pandas import ( Index, NaT, ) import pandas._testing as tm class TestGetSliceBounds: @pytest.mark.parametrize("side, expected", [("left", 4), ("right", 5)]) def test_get_slice_bounds_within(self, sid...
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/base_class/test_setops.py
pandas/tests/indexes/base_class/test_setops.py
from datetime import datetime import numpy as np import pytest import pandas as pd from pandas import ( Index, Series, ) import pandas._testing as tm from pandas.core.algorithms import safe_sort def equal_contents(arr1, arr2) -> bool: """ Checks if the set of unique elements of arr1 and arr2 are equ...
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/base_class/test_constructors.py
pandas/tests/indexes/base_class/test_constructors.py
import numpy as np import pytest import pandas as pd from pandas import ( Index, MultiIndex, Series, ) import pandas._testing as tm class TestIndexConstructor: # Tests for the Index constructor, specifically for cases that do # not return a subclass @pytest.mark.parametrize("value", [1, np....
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/base_class/test_formats.py
pandas/tests/indexes/base_class/test_formats.py
import numpy as np import pytest import pandas._config.config as cf from pandas import Index import pandas._testing as tm class TestIndexRendering: def test_repr_is_valid_construction_code(self): # for the case of Index, where the repr is traditional rather than # stylized idx = 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/indexes/base_class/__init__.py
pandas/tests/indexes/base_class/__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/indexes/base_class/test_pickle.py
pandas/tests/indexes/base_class/test_pickle.py
from pandas import Index import pandas._testing as tm def test_pickle_preserves_object_dtype(tmp_path): # GH#43188, GH#43155 don't infer numeric dtype index = Index([1, 2, 3], dtype=object) result = tm.round_trip_pickle(index, tmp_path) assert result.dtype == object tm.assert_index_equal(index, 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/indexes/base_class/test_where.py
pandas/tests/indexes/base_class/test_where.py
import numpy as np from pandas import Index import pandas._testing as tm class TestWhere: def test_where_intlike_str_doesnt_cast_ints(self): idx = Index(range(3)) mask = np.array([True, False, True]) res = idx.where(mask, "2") expected = Index([0, "2", 2]) tm.assert_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/indexes/categorical/test_category.py
pandas/tests/indexes/categorical/test_category.py
import numpy as np import pytest from pandas._libs import index as libindex from pandas._libs.arrays import NDArrayBacked from pandas.errors import Pandas4Warning import pandas as pd from pandas import ( Categorical, CategoricalDtype, ) import pandas._testing as tm from pandas.core.indexes.api import ( Ca...
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/categorical/test_equals.py
pandas/tests/indexes/categorical/test_equals.py
import numpy as np import pytest from pandas import ( Categorical, CategoricalIndex, Index, MultiIndex, ) class TestEquals: def test_equals_categorical(self): ci1 = CategoricalIndex(["a", "b"], categories=["a", "b"], ordered=True) ci2 = CategoricalIndex(["a", "b"], categories=["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/indexes/categorical/test_indexing.py
pandas/tests/indexes/categorical/test_indexing.py
import numpy as np import pytest from pandas.errors import InvalidIndexError import pandas as pd from pandas import ( CategoricalIndex, Index, IntervalIndex, Timestamp, ) import pandas._testing as tm class TestTake: def test_take_fill_value(self): # GH 12631 # numeric category ...
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/categorical/test_setops.py
pandas/tests/indexes/categorical/test_setops.py
import numpy as np import pytest from pandas import ( CategoricalIndex, Index, ) import pandas._testing as tm @pytest.mark.parametrize("na_value", [None, np.nan]) def test_difference_with_na(na_value): # GH 57318 ci = CategoricalIndex(["a", "b", "c", None]) other = Index(["c", na_value]) resu...
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/categorical/test_astype.py
pandas/tests/indexes/categorical/test_astype.py
from datetime import date import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas import ( Categorical, CategoricalDtype, CategoricalIndex, Index, IntervalIndex, ) import pandas._testing as tm class TestAstype: def test_astype(self): ci = CategoricalInd...
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/categorical/test_constructors.py
pandas/tests/indexes/categorical/test_constructors.py
import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas import ( Categorical, CategoricalDtype, CategoricalIndex, Index, ) import pandas._testing as tm class TestCategoricalIndexConstructors: def test_construction_disallows_scalar(self): msg = "must be calle...
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/categorical/test_map.py
pandas/tests/indexes/categorical/test_map.py
import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, Index, Series, ) import pandas._testing as tm @pytest.mark.parametrize( "data, categories", [ (list("abcbca"), list("cab")), (pd.interval_range(0, 3).repeat(3), pd.interval_range(0, 3)), ...
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/categorical/test_append.py
pandas/tests/indexes/categorical/test_append.py
import pytest from pandas import ( CategoricalIndex, Index, ) import pandas._testing as tm class TestAppend: @pytest.fixture def ci(self): categories = list("cab") return CategoricalIndex(list("aabbca"), categories=categories, ordered=False) def test_append(self, ci): # 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/indexes/categorical/test_formats.py
pandas/tests/indexes/categorical/test_formats.py
""" Tests for CategoricalIndex.__repr__ and related methods. """ import pandas._config.config as cf from pandas import CategoricalIndex class TestCategoricalIndexReprStringCategories: def test_string_categorical_index_repr(self): # short idx = CategoricalIndex(["a", "bb", "ccc"]) expecte...
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/categorical/__init__.py
pandas/tests/indexes/categorical/__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/indexes/categorical/test_reindex.py
pandas/tests/indexes/categorical/test_reindex.py
import numpy as np import pytest from pandas import ( Categorical, CategoricalIndex, Index, Interval, ) import pandas._testing as tm class TestReindex: def test_reindex_list_non_unique(self): # GH#11586 msg = "cannot reindex on an axis with duplicate labels" ci = Categoric...
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/categorical/test_fillna.py
pandas/tests/indexes/categorical/test_fillna.py
import numpy as np import pytest from pandas import CategoricalIndex import pandas._testing as tm class TestFillNA: def test_fillna_categorical(self): # GH#11343 idx = CategoricalIndex([1.0, np.nan, 3.0, 1.0], name="x") # fill by value in categories exp = CategoricalIndex([1.0, 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/indexes/timedeltas/test_join.py
pandas/tests/indexes/timedeltas/test_join.py
import numpy as np from pandas import ( DataFrame, Index, Timedelta, timedelta_range, ) import pandas._testing as tm class TestJoin: def test_append_join_nondatetimeindex(self): rng = timedelta_range("1 days", periods=10) idx = Index(["a", "b", "c", "d"]) result = rng.app...
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/timedeltas/test_indexing.py
pandas/tests/indexes/timedeltas/test_indexing.py
from datetime import datetime import re import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas import ( Index, NaT, Timedelta, TimedeltaIndex, Timestamp, notna, offsets, timedelta_range, to_timedelta, ) import pandas._testing as tm class TestGetIte...
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/timedeltas/test_searchsorted.py
pandas/tests/indexes/timedeltas/test_searchsorted.py
import numpy as np import pytest from pandas import ( TimedeltaIndex, Timestamp, ) import pandas._testing as tm class TestSearchSorted: def test_searchsorted_different_argument_classes(self, listlike_box): idx = TimedeltaIndex(["1 day", "2 days", "3 days"]) result = idx.searchsorted(listl...
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/timedeltas/test_setops.py
pandas/tests/indexes/timedeltas/test_setops.py
import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd from pandas import ( Index, TimedeltaIndex, timedelta_range, ) import pandas._testing as tm from pandas.tseries.offsets import Hour class TestTimedeltaIndex: def test_union(self): i1 = timedelta_ra...
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/timedeltas/test_delete.py
pandas/tests/indexes/timedeltas/test_delete.py
from pandas import ( TimedeltaIndex, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndexDelete: def test_delete(self): idx = timedelta_range(start="1 Days", periods=5, freq="D", name="idx") # preserve freq expected_0 = timedelta_range(start="2 Days", periods=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/indexes/timedeltas/test_freq_attr.py
pandas/tests/indexes/timedeltas/test_freq_attr.py
import pytest from pandas import TimedeltaIndex from pandas.tseries.offsets import ( DateOffset, Day, Hour, MonthEnd, ) class TestFreq: @pytest.mark.parametrize("values", [["0 days", "2 days", "4 days"], []]) @pytest.mark.parametrize("freq", ["2D", Day(2), "48h", Hour(48)]) def test_freq...
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/timedeltas/test_timedelta.py
pandas/tests/indexes/timedeltas/test_timedelta.py
import numpy as np import pytest from pandas import ( Index, Series, Timedelta, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndex: def test_misc_coverage(self): rng = timedelta_range("1 day", periods=5) result = rng.groupby(rng.days) assert isinstanc...
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/timedeltas/test_constructors.py
pandas/tests/indexes/timedeltas/test_constructors.py
from datetime import timedelta import numpy as np import pytest from pandas.errors import Pandas4Warning import pandas as pd from pandas import ( Timedelta, TimedeltaIndex, timedelta_range, to_timedelta, ) import pandas._testing as tm from pandas.core.arrays.timedeltas import TimedeltaArray class T...
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/timedeltas/test_formats.py
pandas/tests/indexes/timedeltas/test_formats.py
import pytest import pandas as pd from pandas import ( Series, TimedeltaIndex, ) class TestTimedeltaIndexRendering: def test_repr_round_days_non_nano(self): # GH#55405 # we should get "1 days", not "1 days 00:00:00" with non-nano tdi = TimedeltaIndex(["1 days"], freq="D").as_unit(...
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/timedeltas/test_ops.py
pandas/tests/indexes/timedeltas/test_ops.py
from pandas import ( TimedeltaIndex, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndexOps: def test_infer_freq(self, freq_sample): # GH#11018 idx = timedelta_range("1", freq=freq_sample, periods=10) result = TimedeltaIndex(idx.asi8, freq="infer") tm.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/indexes/timedeltas/test_scalar_compat.py
pandas/tests/indexes/timedeltas/test_scalar_compat.py
""" Tests for TimedeltaIndex methods behaving like their Timedelta counterparts """ import numpy as np import pytest from pandas._libs.tslibs.offsets import INVALID_FREQ_ERR_MSG from pandas.errors import Pandas4Warning from pandas import ( Index, Series, Timedelta, TimedeltaIndex, timedelta_range...
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/timedeltas/__init__.py
pandas/tests/indexes/timedeltas/__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/indexes/timedeltas/test_arithmetic.py
pandas/tests/indexes/timedeltas/test_arithmetic.py
# Arithmetic tests for TimedeltaIndex are generally about the result's `freq` attribute. # Other cases can be shared in tests.arithmetic.test_timedelta64 import numpy as np from pandas import ( NaT, Timedelta, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndexArithmetic: 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/indexes/timedeltas/test_timedelta_range.py
pandas/tests/indexes/timedeltas/test_timedelta_range.py
import numpy as np import pytest from pandas.errors import Pandas4Warning from pandas import ( Timedelta, timedelta_range, to_timedelta, ) import pandas._testing as tm from pandas.tseries.offsets import ( Day, Second, ) class TestTimedeltas: def test_timedelta_range_unit(self): # 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/indexes/timedeltas/test_pickle.py
pandas/tests/indexes/timedeltas/test_pickle.py
from pandas import timedelta_range import pandas._testing as tm class TestPickle: def test_pickle_after_set_freq(self, tmp_path): tdi = timedelta_range("1 day", periods=4, freq="s") tdi = tdi._with_freq(None) res = tm.round_trip_pickle(tdi, tmp_path) tm.assert_index_equal(res, tdi...
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/timedeltas/methods/test_insert.py
pandas/tests/indexes/timedeltas/methods/test_insert.py
from datetime import timedelta import numpy as np import pytest from pandas._libs import lib import pandas as pd from pandas import ( Index, Timedelta, TimedeltaIndex, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndexInsert: def test_insert(self): idx = TimedeltaI...
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/timedeltas/methods/test_factorize.py
pandas/tests/indexes/timedeltas/methods/test_factorize.py
import numpy as np from pandas import ( TimedeltaIndex, factorize, timedelta_range, ) import pandas._testing as tm class TestTimedeltaIndexFactorize: def test_factorize(self): idx1 = TimedeltaIndex(["1 day", "1 day", "2 day", "2 day", "3 day", "3 day"]) exp_arr = np.array([0, 0, 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/indexes/timedeltas/methods/test_repeat.py
pandas/tests/indexes/timedeltas/methods/test_repeat.py
import numpy as np from pandas import ( TimedeltaIndex, timedelta_range, ) import pandas._testing as tm class TestRepeat: def test_repeat(self): index = timedelta_range("1 days", periods=2, freq="D") exp = TimedeltaIndex(["1 days", "1 days", "2 days", "2 days"]) for res in [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/indexes/timedeltas/methods/test_astype.py
pandas/tests/indexes/timedeltas/methods/test_astype.py
from datetime import timedelta import numpy as np import pytest import pandas as pd from pandas import ( Index, NaT, Timedelta, TimedeltaIndex, timedelta_range, ) import pandas._testing as tm from pandas.core.arrays import TimedeltaArray class TestTimedeltaIndex: def test_astype_object(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/indexes/timedeltas/methods/test_shift.py
pandas/tests/indexes/timedeltas/methods/test_shift.py
import pytest from pandas.errors import NullFrequencyError import pandas as pd from pandas import TimedeltaIndex import pandas._testing as tm class TestTimedeltaIndexShift: # ------------------------------------------------------------- # TimedeltaIndex.shift is used by __add__/__sub__ def test_tdi_shi...
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/timedeltas/methods/__init__.py
pandas/tests/indexes/timedeltas/methods/__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/indexes/timedeltas/methods/test_fillna.py
pandas/tests/indexes/timedeltas/methods/test_fillna.py
from pandas import ( Index, NaT, Timedelta, TimedeltaIndex, ) import pandas._testing as tm class TestFillNA: def test_fillna_timedelta(self): # GH#11343 idx = TimedeltaIndex(["1 day", NaT, "3 day"]) exp = TimedeltaIndex(["1 day", "2 day", "3 day"]) tm.assert_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/indexes/multi/test_reshape.py
pandas/tests/indexes/multi/test_reshape.py
from datetime import datetime import zoneinfo import numpy as np import pytest import pandas as pd from pandas import ( Index, MultiIndex, ) import pandas._testing as tm def test_insert(idx): # key contained in all levels new_index = idx.insert(0, ("bar", "two")) assert new_index.equal_levels(id...
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/multi/test_conversion.py
pandas/tests/indexes/multi/test_conversion.py
import numpy as np import pytest from pandas.compat.numpy import np_version_gt2 import pandas as pd from pandas import ( DataFrame, MultiIndex, RangeIndex, ) import pandas._testing as tm def test_to_numpy(idx): result = idx.to_numpy() exp = idx.values tm.assert_numpy_array_equal(result, exp)...
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/multi/test_analytics.py
pandas/tests/indexes/multi/test_analytics.py
import numpy as np import pytest import pandas as pd from pandas import ( Index, MultiIndex, date_range, period_range, ) import pandas._testing as tm def test_infer_objects(idx): with pytest.raises(NotImplementedError, match="to_frame"): idx.infer_objects() def test_shift(idx): # 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/indexes/multi/test_lexsort.py
pandas/tests/indexes/multi/test_lexsort.py
from pandas import MultiIndex class TestIsLexsorted: def test_is_lexsorted(self): levels = [[0, 1], [0, 1, 2]] index = MultiIndex( levels=levels, codes=[[0, 0, 0, 1, 1, 1], [0, 1, 2, 0, 1, 2]] ) assert index._is_lexsorted() index = MultiIndex( leve...
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/multi/test_join.py
pandas/tests/indexes/multi/test_join.py
import numpy as np import pytest from pandas import ( DataFrame, Index, Interval, MultiIndex, Series, StringDtype, ) import pandas._testing as tm @pytest.mark.parametrize("other", [["three", "one", "two"], ["one"], ["one", "three"]]) def test_join_level(idx, other, join_type): other = Ind...
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/multi/test_indexing.py
pandas/tests/indexes/multi/test_indexing.py
from collections import namedtuple from datetime import timedelta import re import numpy as np import pytest from pandas._libs import index as libindex from pandas.errors import InvalidIndexError import pandas as pd from pandas import ( Categorical, DataFrame, Index, MultiIndex, date_range, ) imp...
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/multi/test_equivalence.py
pandas/tests/indexes/multi/test_equivalence.py
import numpy as np import pytest from pandas.core.dtypes.common import is_any_real_numeric_dtype import pandas as pd from pandas import ( Index, MultiIndex, Series, ) import pandas._testing as tm def test_equals(idx): assert idx.equals(idx) assert idx.equals(idx.copy()) assert idx.equals(idx...
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/multi/test_setops.py
pandas/tests/indexes/multi/test_setops.py
import numpy as np import pytest import pandas as pd from pandas import ( CategoricalIndex, DataFrame, Index, IntervalIndex, MultiIndex, Series, ) import pandas._testing as tm from pandas.api.types import ( is_float_dtype, is_unsigned_integer_dtype, ) @pytest.mark.parametrize("case", ...
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/multi/test_partial_indexing.py
pandas/tests/indexes/multi/test_partial_indexing.py
import numpy as np import pytest from pandas import ( DataFrame, IndexSlice, MultiIndex, date_range, ) import pandas._testing as tm @pytest.fixture def df(): # c1 # 2016-01-01 00:00:00 a 0 # b 1 # c 2 # 2016-01-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/indexes/multi/test_take.py
pandas/tests/indexes/multi/test_take.py
import numpy as np import pytest import pandas as pd import pandas._testing as tm def test_take(idx): indexer = [4, 3, 0, 2] result = idx.take(indexer) expected = idx[indexer] assert result.equals(expected) # GH 10791 msg = "'MultiIndex' object has no attribute 'freq'" with pytest.raises...
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/multi/test_sorting.py
pandas/tests/indexes/multi/test_sorting.py
import numpy as np import pytest from pandas.errors import UnsortedIndexError from pandas import ( CategoricalIndex, DataFrame, Index, MultiIndex, RangeIndex, Series, Timestamp, ) import pandas._testing as tm from pandas.core.indexes.frozen import FrozenList def test_sortlevel(idx): ...
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/multi/test_util.py
pandas/tests/indexes/multi/test_util.py
import numpy as np import pytest from pandas import ( Index, date_range, ) import pandas._testing as tm from pandas.core.indexes.multi import cartesian_product class TestCartesianProduct: def test_simple(self): x, y = list("ABC"), [1, 22] result1, result2 = cartesian_product([x, y]) ...
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/multi/test_astype.py
pandas/tests/indexes/multi/test_astype.py
import numpy as np import pytest from pandas.core.dtypes.dtypes import CategoricalDtype import pandas._testing as tm def test_astype(idx): expected = idx.copy() actual = idx.astype("O") tm.assert_copy(actual.levels, expected.levels) tm.assert_copy(actual.codes, expected.codes) assert actual.name...
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/multi/test_missing.py
pandas/tests/indexes/multi/test_missing.py
import numpy as np import pytest import pandas as pd from pandas import MultiIndex import pandas._testing as tm def test_fillna(idx): # GH 11343 msg = "fillna is not defined for MultiIndex" with pytest.raises(NotImplementedError, match=msg): idx.fillna(idx[0]) def test_dropna(): # GH 6194 ...
python
BSD-3-Clause
91514c363604506f447e53380d3aa00520f1037b
2026-01-04T14:39:36.002480Z
false