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/multi/test_constructors.py | pandas/tests/indexes/multi/test_constructors.py | from datetime import (
date,
datetime,
)
import itertools
import numpy as np
import pytest
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
import pandas as pd
from pandas import (
Index,
MultiIndex,
Series,
Timestamp,
date_range,
)
import pandas._testing as tm
... | 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_isin.py | pandas/tests/indexes/multi/test_isin.py | import numpy as np
import pytest
from pandas import MultiIndex
import pandas._testing as tm
def test_isin_nan():
idx = MultiIndex.from_arrays([["foo", "bar"], [1.0, np.nan]])
tm.assert_numpy_array_equal(idx.isin([("bar", np.nan)]), np.array([False, True]))
tm.assert_numpy_array_equal(
idx.isin([(... | 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_names.py | pandas/tests/indexes/multi/test_names.py | import pytest
import pandas as pd
from pandas import MultiIndex
import pandas._testing as tm
def check_level_names(index, names):
assert [level.name for level in index.levels] == list(names)
def test_slice_keep_name():
x = MultiIndex.from_tuples([("a", "b"), (1, 2), ("c", "d")], names=["x", "y"])
asser... | 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/conftest.py | pandas/tests/indexes/multi/conftest.py | import numpy as np
import pytest
from pandas import (
Index,
MultiIndex,
)
# Note: identical the "multi" entry in the top-level "index" fixture
@pytest.fixture
def idx():
# a MultiIndex used to test the general functionality of the
# general functionality of this object
major_axis = Index(["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/indexes/multi/test_get_level_values.py | pandas/tests/indexes/multi/test_get_level_values.py | import numpy as np
import pandas as pd
from pandas import (
CategoricalIndex,
Index,
MultiIndex,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestGetLevelValues:
def test_get_level_values_box_datetime64(self):
dates = date_range("1/1/2000", periods=4)
levels = [... | 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_get_set.py | pandas/tests/indexes/multi/test_get_set.py | import numpy as np
import pytest
from pandas.core.dtypes.dtypes import DatetimeTZDtype
import pandas as pd
from pandas import (
CategoricalIndex,
MultiIndex,
)
import pandas._testing as tm
def assert_matching(actual, expected, check_dtype=False):
# avoid specifying internal representation
# as much ... | 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_monotonic.py | pandas/tests/indexes/multi/test_monotonic.py | import numpy as np
import pytest
from pandas import (
Index,
MultiIndex,
)
def test_is_monotonic_increasing_lexsorted(lexsorted_two_level_string_multiindex):
# string ordering
mi = lexsorted_two_level_string_multiindex
assert mi.is_monotonic_increasing is False
assert Index(mi.values).is_mono... | 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_compat.py | pandas/tests/indexes/multi/test_compat.py | import numpy as np
import pytest
import pandas as pd
from pandas import MultiIndex
import pandas._testing as tm
def test_numeric_compat(idx):
with pytest.raises(TypeError, match="cannot perform __mul__"):
idx * 1
with pytest.raises(TypeError, match="cannot perform __rmul__"):
1 * idx
di... | 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_formats.py | pandas/tests/indexes/multi/test_formats.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
def test_repr_with_unicode_data():
with pd.option_context("display.encoding", "UTF-8"):
d = {"a": ["\u05d0", 2, 3], "b": [4, 5, 6], "c": [7, 8, 9]}
index = pd.DataFrame(d).set_index(["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/indexes/multi/test_duplicates.py | pandas/tests/indexes/multi/test_duplicates.py | from itertools import product
import numpy as np
import pytest
from pandas._libs import (
hashtable,
index as libindex,
)
from pandas import (
NA,
DatetimeIndex,
Index,
MultiIndex,
Series,
)
import pandas._testing as tm
@pytest.fixture
def idx_dup():
# compare tests/indexes/multi/co... | 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/__init__.py | pandas/tests/indexes/multi/__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/multi/test_copy.py | pandas/tests/indexes/multi/test_copy.py | from copy import (
copy,
deepcopy,
)
import pytest
from pandas import MultiIndex
import pandas._testing as tm
def assert_multiindex_copied(copy, original):
# Levels should be (at least, shallow copied)
tm.assert_copy(copy.levels, original.levels)
tm.assert_almost_equal(copy.codes, original.codes... | 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_reindex.py | pandas/tests/indexes/multi/test_reindex.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
import pandas._testing as tm
def test_reindex(idx):
result, indexer = idx.reindex(list(idx[:4]))
assert isinstance(result, MultiIndex)
assert result.names == ["first", "second"]
assert [level.name f... | 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_integrity.py | pandas/tests/indexes/multi/test_integrity.py | import re
import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.core.dtypes.cast import construct_1d_object_array_from_listlike
import pandas as pd
from pandas import (
Index,
IntervalIndex,
MultiIndex,
RangeIndex,
)
import pandas._testing as tm
def test_labels_dt... | 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_pickle.py | pandas/tests/indexes/multi/test_pickle.py | import pytest
from pandas import MultiIndex
def test_pickle_compat_construction():
# this is testing for pickle compat
# need an object to create with
with pytest.raises(TypeError, match="Must pass both levels and codes"):
MultiIndex()
| 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_drop.py | pandas/tests/indexes/multi/test_drop.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
MultiIndex,
)
import pandas._testing as tm
def test_drop(idx):
dropped = idx.drop([("foo", "two"), ("qux", "one")])
index = MultiIndex.from_tuples([("foo", "two"), ("qux", "one")])
dropped2 = idx.drop(index)
ex... | 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/interval/test_interval_range.py | pandas/tests/indexes/interval/test_interval_range.py | from datetime import timedelta
import numpy as np
import pytest
from pandas.core.dtypes.common import is_integer
from pandas import (
DateOffset,
Interval,
IntervalIndex,
Timedelta,
Timestamp,
date_range,
interval_range,
timedelta_range,
)
import pandas._testing as tm
from pandas.tse... | 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/interval/test_join.py | pandas/tests/indexes/interval/test_join.py | import pytest
from pandas import (
IntervalIndex,
MultiIndex,
RangeIndex,
)
import pandas._testing as tm
@pytest.fixture
def range_index():
return RangeIndex(3, name="range_index")
@pytest.fixture
def interval_index():
return IntervalIndex.from_tuples(
[(0.0, 1.0), (1.0, 2.0), (1.5, 2.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/indexes/interval/test_equals.py | pandas/tests/indexes/interval/test_equals.py | import numpy as np
from pandas import (
IntervalIndex,
date_range,
)
class TestEquals:
def test_equals(self, closed):
expected = IntervalIndex.from_breaks(np.arange(5), closed=closed)
assert expected.equals(expected)
assert expected.equals(expected.copy())
assert not expe... | 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/interval/test_indexing.py | pandas/tests/indexes/interval/test_indexing.py | import re
import numpy as np
import pytest
from pandas.errors import InvalidIndexError
from pandas import (
NA,
CategoricalIndex,
DatetimeIndex,
Index,
Interval,
IntervalIndex,
MultiIndex,
NaT,
Timedelta,
Timestamp,
array,
date_range,
interval_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/indexes/interval/test_setops.py | pandas/tests/indexes/interval/test_setops.py | import numpy as np
import pytest
from pandas import (
Index,
IntervalIndex,
Timestamp,
interval_range,
)
import pandas._testing as tm
def monotonic_index(start, end, dtype="int64", closed="right"):
return IntervalIndex.from_breaks(np.arange(start, end, dtype=dtype), closed=closed)
def empty_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/interval/test_interval.py | pandas/tests/indexes/interval/test_interval.py | from itertools import permutations
import re
import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
Interval,
IntervalIndex,
Timedelta,
Timestamp,
date_range,
interval_range,
isna,
notna,
timedelta_range,
)
import pandas._testing as tm
import pandas.co... | 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/interval/test_astype.py | pandas/tests/indexes/interval/test_astype.py | import re
import numpy as np
import pytest
from pandas.errors import Pandas4Warning
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
IntervalDtype,
)
from pandas import (
CategoricalIndex,
Index,
IntervalIndex,
NaT,
Timedelta,
Timestamp,
interval_range,
)
import pandas._... | 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/interval/test_constructors.py | pandas/tests/indexes/interval/test_constructors.py | from functools import partial
import numpy as np
import pytest
import pandas.util._test_decorators as td
from pandas.core.dtypes.common import is_unsigned_integer_dtype
from pandas.core.dtypes.dtypes import IntervalDtype
from pandas import (
Categorical,
CategoricalDtype,
CategoricalIndex,
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/interval/test_formats.py | pandas/tests/indexes/interval/test_formats.py | import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Interval,
IntervalIndex,
Series,
Timedelta,
Timestamp,
)
import pandas._testing as tm
class TestIntervalIndexRendering:
# TODO: this is a test for DataFrame/Series, not IntervalIndex
@pytest... | 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/interval/__init__.py | pandas/tests/indexes/interval/__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/interval/test_pickle.py | pandas/tests/indexes/interval/test_pickle.py | from pandas import IntervalIndex
import pandas._testing as tm
class TestPickle:
def test_pickle_round_trip_closed(self, closed, tmp_path):
# https://github.com/pandas-dev/pandas/issues/35658
idx = IntervalIndex.from_tuples([(1, 2), (2, 3)], closed=closed)
result = tm.round_trip_pickle(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/interval/test_interval_tree.py | pandas/tests/indexes/interval/test_interval_tree.py | from itertools import permutations
import numpy as np
import pytest
from pandas._libs.interval import IntervalTree
from pandas.compat import (
IS64,
WASM,
)
import pandas._testing as tm
def skipif_32bit(param):
"""
Skip parameters in a parametrize on 32bit systems. Specifically used
here to ski... | 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/object/test_indexing.py | pandas/tests/indexes/object/test_indexing.py | from decimal import Decimal
import numpy as np
import pytest
from pandas._libs.missing import is_matching_na
from pandas import Index
import pandas._testing as tm
class TestGetIndexer:
@pytest.mark.parametrize(
"method,expected",
[
("pad", [-1, 0, 1, 1]),
("backfill", [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/object/test_astype.py | pandas/tests/indexes/object/test_astype.py | import pytest
from pandas import (
Index,
NaT,
)
def test_astype_invalid_nas_to_tdt64_raises():
# GH#45722 don't cast np.datetime64 NaTs to timedelta64 NaT
idx = Index([NaT.asm8] * 2, dtype=object)
msg = r"Invalid type for timedelta scalar: <class 'numpy.datetime64'>"
with pytest.raises(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/indexes/object/__init__.py | pandas/tests/indexes/object/__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/ranges/test_range.py | pandas/tests/indexes/ranges/test_range.py | import numpy as np
import pytest
from pandas.core.dtypes.common import ensure_platform_int
import pandas as pd
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
from pandas.core.indexes.range import min_fitting_element
class TestRangeIndex:
@pytest.fixture
def simple_index(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/ranges/test_join.py | pandas/tests/indexes/ranges/test_join.py | import numpy as np
import pytest
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
class TestJoin:
def test_join_outer(self):
# join with Index[int64]
index = RangeIndex(start=0, stop=20, step=2)
other = Index(np.arange(25, 14, -1, dtype=np.int64))
re... | 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/ranges/test_indexing.py | pandas/tests/indexes/ranges/test_indexing.py | import numpy as np
import pytest
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
class TestGetIndexer:
def test_get_indexer(self):
index = RangeIndex(start=0, stop=20, step=2)
target = RangeIndex(10)
indexer = index.get_indexer(target)
expected = 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/ranges/test_setops.py | pandas/tests/indexes/ranges/test_setops.py | from datetime import (
datetime,
timedelta,
)
from hypothesis import (
assume,
given,
strategies as st,
)
import numpy as np
import pytest
from pandas import (
Index,
RangeIndex,
)
import pandas._testing as tm
class TestRangeIndexSetOps:
@pytest.mark.parametrize("dtype", [None, "int6... | 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/ranges/test_constructors.py | pandas/tests/indexes/ranges/test_constructors.py | from datetime import datetime
import numpy as np
import pytest
from pandas import (
Index,
RangeIndex,
Series,
)
import pandas._testing as tm
class TestRangeIndexConstructors:
@pytest.mark.parametrize("name", [None, "foo"])
@pytest.mark.parametrize(
"args, kwargs, start, stop, step",
... | 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/ranges/__init__.py | pandas/tests/indexes/ranges/__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/numeric/test_join.py | pandas/tests/indexes/numeric/test_join.py | import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.indexes.api import Index
class TestJoinInt64Index:
def test_join_non_unique(self):
left = Index([4, 4, 3, 3])
joined, lidx, ridx = left.join(left, return_indexers=True)
exp_joined = Index([4, 4, 4, 4, 3, 3, 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/numeric/test_indexing.py | pandas/tests/indexes/numeric/test_indexing.py | import numpy as np
import pytest
from pandas.errors import InvalidIndexError
from pandas import (
NA,
Index,
RangeIndex,
Series,
Timestamp,
)
import pandas._testing as tm
from pandas.core.arrays import (
ArrowExtensionArray,
FloatingArray,
)
class TestGetLoc:
def test_get_loc(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/numeric/test_setops.py | pandas/tests/indexes/numeric/test_setops.py | from datetime import (
datetime,
timedelta,
)
import numpy as np
import pytest
import pandas._testing as tm
from pandas.core.indexes.api import (
Index,
RangeIndex,
)
@pytest.fixture
def index_large():
# large values used in TestUInt64Index where no compat needed with int64/float64
large = [... | 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/numeric/test_astype.py | pandas/tests/indexes/numeric/test_astype.py | import numpy as np
import pytest
from pandas import (
Index,
to_datetime,
to_timedelta,
)
import pandas._testing as tm
class TestAstype:
def test_astype_float64_to_uint64(self):
# GH#45309 used to incorrectly return Index with int64 dtype
idx = Index([0.0, 5.0, 10.0, 15.0, 20.0], dtyp... | 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/numeric/test_numeric.py | pandas/tests/indexes/numeric/test_numeric.py | import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
Series,
)
import pandas._testing as tm
class TestFloatNumericIndex:
@pytest.fixture(params=[np.float64, np.float32])
def dtype(self, request):
return request.param
@pytest.fixture
def mixed_index(self, 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/numeric/__init__.py | pandas/tests/indexes/numeric/__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/datetimes/test_join.py | pandas/tests/indexes/datetimes/test_join.py | from datetime import (
datetime,
timezone,
)
import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Timestamp,
date_range,
period_range,
to_datetime,
)
import pandas._testing as tm
from pandas.tseries.offsets import (
BDay,
BMonthEnd,
)
cl... | 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/datetimes/test_datetime.py | pandas/tests/indexes/datetimes/test_datetime.py | import datetime as dt
from datetime import date
import numpy as np
import pytest
from pandas.compat.numpy import np_long
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Timestamp,
date_range,
offsets,
)
import pandas._testing as tm
class TestDatetimeIndex:
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/datetimes/test_indexing.py | pandas/tests/indexes/datetimes/test_indexing.py | from datetime import (
date,
datetime,
time,
timedelta,
)
import numpy as np
import pytest
from pandas._libs import index as libindex
from pandas.compat.numpy import np_long
from pandas.errors import Pandas4Warning
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
... | 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/datetimes/test_setops.py | pandas/tests/indexes/datetimes/test_setops.py | from datetime import (
datetime,
timedelta,
timezone,
)
import numpy as np
import pytest
import pandas.util._test_decorators as td
import pandas as pd
from pandas import (
DataFrame,
DatetimeIndex,
Index,
Series,
Timestamp,
bdate_range,
date_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/indexes/datetimes/test_timezones.py | pandas/tests/indexes/datetimes/test_timezones.py | """
Tests for DatetimeIndex timezone-related methods
"""
from datetime import (
datetime,
timedelta,
timezone,
tzinfo,
)
import zoneinfo
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas._libs.tslibs import (
conversion,
timezones,
)
import pandas as pd
from pandas 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/datetimes/test_freq_attr.py | pandas/tests/indexes/datetimes/test_freq_attr.py | import pytest
from pandas import (
DatetimeIndex,
date_range,
)
from pandas.tseries.offsets import (
BDay,
DateOffset,
Day,
Hour,
)
class TestFreq:
def test_freq_setter_errors(self):
# GH#20678
idx = DatetimeIndex(["20180101", "20180103", "20180105"])
# setting 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/indexes/datetimes/test_date_range.py | pandas/tests/indexes/datetimes/test_date_range.py | """
test date_range, bdate_range construction from the convenience range functions
"""
from datetime import (
datetime,
time,
timedelta,
)
import re
import numpy as np
import pytest
from pandas._libs.tslibs import timezones
from pandas._libs.tslibs.offsets import (
BDay,
CDay,
DateOffset,
... | 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/datetimes/test_constructors.py | pandas/tests/indexes/datetimes/test_constructors.py | from __future__ import annotations
from datetime import (
datetime,
timedelta,
timezone,
)
from functools import partial
from operator import attrgetter
import zoneinfo
import dateutil
import dateutil.tz
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas._libs.tslibs 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/datetimes/test_formats.py | pandas/tests/indexes/datetimes/test_formats.py | from datetime import (
datetime,
timezone,
)
import dateutil.tz
import numpy as np
import pytest
import pandas as pd
from pandas import (
DatetimeIndex,
NaT,
Series,
)
import pandas._testing as tm
def test_get_values_for_csv():
index = pd.date_range(freq="1D", periods=3, start="2017-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/datetimes/test_ops.py | pandas/tests/indexes/datetimes/test_ops.py | from datetime import datetime
import pytest
from pandas import (
DatetimeIndex,
Index,
bdate_range,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndexOps:
def test_infer_freq(self, freq_sample):
# GH 11018
idx = date_range("2011-01-01 09:00:00", freq=freq_sample, ... | 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/datetimes/test_scalar_compat.py | pandas/tests/indexes/datetimes/test_scalar_compat.py | """
Tests for DatetimeIndex methods behaving like their Timestamp counterparts
"""
import calendar
from datetime import (
date,
datetime,
time,
)
import locale
import unicodedata
from hypothesis import given
import hypothesis.strategies as st
import numpy as np
import pytest
from pandas._libs.tslibs impo... | 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/datetimes/test_partial_slicing.py | pandas/tests/indexes/datetimes/test_partial_slicing.py | """test partial slicing on Series/Frame"""
from datetime import datetime
import numpy as np
import pytest
from pandas import (
DataFrame,
DatetimeIndex,
Index,
MultiIndex,
Series,
Timedelta,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestSlicing:
def test_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/indexes/datetimes/__init__.py | pandas/tests/indexes/datetimes/__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/datetimes/test_reindex.py | pandas/tests/indexes/datetimes/test_reindex.py | from datetime import timedelta
import numpy as np
from pandas import (
DatetimeIndex,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndexReindex:
def test_reindex_preserves_tz_if_target_is_empty_list_or_array(self):
# GH#7774
index = date_range("2013-01-01", periods=3, tz=... | 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/datetimes/test_arithmetic.py | pandas/tests/indexes/datetimes/test_arithmetic.py | # Arithmetic tests specific to DatetimeIndex are generally about `freq`
# retention or inference. Other arithmetic tests belong in
# tests/arithmetic/test_datetime64.py
from pandas import (
Timedelta,
TimedeltaIndex,
Timestamp,
date_range,
offsets,
timedelta_range,
)
import pandas._testing 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/datetimes/test_pickle.py | pandas/tests/indexes/datetimes/test_pickle.py | import pytest
from pandas import (
NaT,
date_range,
to_datetime,
)
import pandas._testing as tm
class TestPickle:
def test_pickle(self, tmp_path):
# GH#4606
idx = to_datetime(["2013-01-01", NaT, "2014-01-06"])
idx_p = tm.round_trip_pickle(idx, tmp_path)
assert idx_p[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/datetimes/test_npfuncs.py | pandas/tests/indexes/datetimes/test_npfuncs.py | import numpy as np
from pandas import date_range
import pandas._testing as tm
class TestSplit:
def test_split_non_utc(self):
# GH#14042
indices = date_range("2016-01-01 00:00:00+0200", freq="s", periods=10)
result = np.split(indices, indices_or_sections=[])[0]
expected = indices._... | 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/datetimes/test_iter.py | pandas/tests/indexes/datetimes/test_iter.py | import dateutil.tz
import numpy as np
import pytest
from pandas import (
DatetimeIndex,
date_range,
to_datetime,
)
from pandas.core.arrays import datetimes
class TestDatetimeIndexIteration:
@pytest.mark.parametrize(
"tz", [None, "UTC", "US/Central", dateutil.tz.tzoffset(None, -28800)]
)
... | 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/datetimes/methods/test_insert.py | pandas/tests/indexes/datetimes/methods/test_insert.py | from datetime import datetime
import zoneinfo
import numpy as np
import pytest
from pandas import (
NA,
DatetimeIndex,
Index,
NaT,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestInsert:
@pytest.mark.parametrize("null", [None, np.nan, np.datetime64("NaT"), NaT, 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/datetimes/methods/test_to_frame.py | pandas/tests/indexes/datetimes/methods/test_to_frame.py | from pandas import (
DataFrame,
Index,
date_range,
)
import pandas._testing as tm
class TestToFrame:
def test_to_frame_datetime_tz(self):
# GH#25809
idx = date_range(start="2019-01-01", end="2019-01-30", freq="D", tz="UTC")
result = idx.to_frame()
expected = DataFrame(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/datetimes/methods/test_factorize.py | pandas/tests/indexes/datetimes/methods/test_factorize.py | import numpy as np
import pytest
from pandas import (
DatetimeIndex,
Index,
date_range,
factorize,
)
import pandas._testing as tm
class TestDatetimeIndexFactorize:
def test_factorize(self):
idx1 = DatetimeIndex(
["2014-01", "2014-01", "2014-02", "2014-02", "2014-03", "2014-03"... | 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/datetimes/methods/test_unique.py | pandas/tests/indexes/datetimes/methods/test_unique.py | from datetime import (
datetime,
timedelta,
)
from pandas import (
DatetimeIndex,
NaT,
Timestamp,
)
import pandas._testing as tm
def test_unique(tz_naive_fixture):
idx = DatetimeIndex(["2017"] * 2, tz=tz_naive_fixture)
expected = idx[:1]
result = idx.unique()
tm.assert_index_equa... | 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/datetimes/methods/test_isocalendar.py | pandas/tests/indexes/datetimes/methods/test_isocalendar.py | from pandas import (
DataFrame,
DatetimeIndex,
date_range,
)
import pandas._testing as tm
def test_isocalendar_returns_correct_values_close_to_new_year_with_tz():
# GH#6538: Check that DatetimeIndex and its TimeStamp elements
# return the same weekofyear accessor close to new year w/ tz
dates ... | 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/datetimes/methods/test_to_series.py | pandas/tests/indexes/datetimes/methods/test_to_series.py | import numpy as np
from pandas import (
DatetimeIndex,
Series,
)
import pandas._testing as tm
class TestToSeries:
def test_to_series(self):
naive = DatetimeIndex(["2013-1-1 13:00", "2013-1-2 14:00"], name="B")
idx = naive.tz_localize("US/Pacific")
expected = Series(np.array(idx.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/datetimes/methods/test_normalize.py | pandas/tests/indexes/datetimes/methods/test_normalize.py | from dateutil.tz import tzlocal
import numpy as np
import pytest
from pandas.compat import WASM
import pandas.util._test_decorators as td
from pandas import (
DatetimeIndex,
NaT,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestNormalize:
def test_normalize(self):
rng = da... | 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/datetimes/methods/test_repeat.py | pandas/tests/indexes/datetimes/methods/test_repeat.py | import numpy as np
import pytest
from pandas import (
DatetimeIndex,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestRepeat:
def test_repeat_range(self, tz_naive_fixture):
rng = date_range("1/1/2000", "1/1/2001")
result = rng.repeat(5)
assert result.freq is No... | 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/datetimes/methods/test_astype.py | pandas/tests/indexes/datetimes/methods/test_astype.py | from datetime import datetime
import dateutil
import numpy as np
import pytest
import pandas as pd
from pandas import (
DatetimeIndex,
Index,
NaT,
PeriodIndex,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndex:
@pytest.mark.parametrize("tzstr", ["US/Eastern", ... | 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/datetimes/methods/test_delete.py | pandas/tests/indexes/datetimes/methods/test_delete.py | import pytest
from pandas import (
DatetimeIndex,
Series,
date_range,
)
import pandas._testing as tm
class TestDelete:
def test_delete(self, unit):
idx = date_range(
start="2000-01-01", periods=5, freq="ME", name="idx", unit=unit
)
# preserve freq
expected... | 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/datetimes/methods/test_round.py | pandas/tests/indexes/datetimes/methods/test_round.py | import pytest
from pandas._libs.tslibs import to_offset
from pandas._libs.tslibs.offsets import INVALID_FREQ_ERR_MSG
from pandas import (
DatetimeIndex,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndexRound:
def test_round_daily(self):
dti = date_range("20130101 ... | 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/datetimes/methods/test_tz_convert.py | pandas/tests/indexes/datetimes/methods/test_tz_convert.py | from datetime import datetime
import dateutil.tz
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas._libs.tslibs import timezones
from pandas import (
DatetimeIndex,
Index,
NaT,
Timestamp,
date_range,
offsets,
)
import pandas._testing as tm
class TestTZConvert:
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/datetimes/methods/test_snap.py | pandas/tests/indexes/datetimes/methods/test_snap.py | import pytest
from pandas.errors import Pandas4Warning
from pandas import (
DatetimeIndex,
date_range,
)
import pandas._testing as tm
@pytest.mark.filterwarnings(r"ignore:PeriodDtype\[B\] is deprecated:FutureWarning")
@pytest.mark.filterwarnings("ignore:Period with BDay freq:FutureWarning")
@pytest.mark.par... | 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/datetimes/methods/test_tz_localize.py | pandas/tests/indexes/datetimes/methods/test_tz_localize.py | from datetime import (
datetime,
timedelta,
timezone,
)
from zoneinfo import ZoneInfo
import dateutil.tz
from dateutil.tz import gettz
import numpy as np
import pytest
from pandas import (
DatetimeIndex,
Timestamp,
bdate_range,
date_range,
offsets,
to_datetime,
)
import pandas._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/datetimes/methods/test_shift.py | pandas/tests/indexes/datetimes/methods/test_shift.py | from datetime import datetime
import zoneinfo
import pytest
from pandas.errors import NullFrequencyError
import pandas as pd
from pandas import (
DatetimeIndex,
Series,
date_range,
)
import pandas._testing as tm
class TestDatetimeIndexShift:
# -------------------------------------------------------... | 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/datetimes/methods/test_map.py | pandas/tests/indexes/datetimes/methods/test_map.py | import pytest
from pandas import (
DatetimeIndex,
Index,
MultiIndex,
Period,
date_range,
)
import pandas._testing as tm
class TestMap:
def test_map(self):
rng = date_range("1/1/2000", periods=10)
f = lambda x: x.strftime("%Y%m%d")
result = rng.map(f)
exp = 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/datetimes/methods/test_resolution.py | pandas/tests/indexes/datetimes/methods/test_resolution.py | from dateutil.tz import tzlocal
import pytest
from pandas.compat import (
IS64,
WASM,
)
from pandas import date_range
@pytest.mark.parametrize(
"freq,expected",
[
("YE", "day"),
("QE", "day"),
("ME", "day"),
("D", "day"),
("h", "hour"),
("min", "minute... | 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/datetimes/methods/test_to_pydatetime.py | pandas/tests/indexes/datetimes/methods/test_to_pydatetime.py | from datetime import (
datetime,
timezone,
)
import dateutil.parser
import dateutil.tz
from dateutil.tz import tzlocal
import numpy as np
from pandas import (
DatetimeIndex,
date_range,
to_datetime,
)
import pandas._testing as tm
from pandas.tests.indexes.datetimes.test_timezones import FixedOffse... | 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/datetimes/methods/__init__.py | pandas/tests/indexes/datetimes/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/datetimes/methods/test_to_period.py | pandas/tests/indexes/datetimes/methods/test_to_period.py | from datetime import timezone
import dateutil.tz
from dateutil.tz import tzlocal
import pytest
from pandas._libs.tslibs.ccalendar import MONTHS
from pandas._libs.tslibs.offsets import MonthEnd
from pandas._libs.tslibs.period import INVALID_FREQ_ERR_MSG
from pandas import (
DatetimeIndex,
Period,
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/datetimes/methods/test_asof.py | pandas/tests/indexes/datetimes/methods/test_asof.py | from datetime import timedelta
from pandas import (
DatetimeIndex,
Index,
Timestamp,
date_range,
isna,
)
class TestAsOf:
def test_asof_partial(self):
index = date_range("2010-01-01", periods=2, freq="ME")
expected = Timestamp("2010-02-28")
result = index.asof("2010-02"... | 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/datetimes/methods/test_to_julian_date.py | pandas/tests/indexes/datetimes/methods/test_to_julian_date.py | import numpy as np
from pandas import (
Index,
Timestamp,
date_range,
)
import pandas._testing as tm
class TestDateTimeIndexToJulianDate:
def test_1700(self):
dr = date_range(start=Timestamp("1710-10-01"), periods=5, freq="D")
r1 = Index([x.to_julian_date() for x in dr])
r2 = ... | 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/datetimes/methods/test_fillna.py | pandas/tests/indexes/datetimes/methods/test_fillna.py | import pytest
import pandas as pd
import pandas._testing as tm
class TestDatetimeIndexFillNA:
@pytest.mark.parametrize("tz", ["US/Eastern", "Asia/Tokyo"])
def test_fillna_datetime64(self, tz):
# GH 11343
idx = pd.DatetimeIndex(["2011-01-01 09:00", pd.NaT, "2011-01-01 11:00"])
exp = p... | 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/libs/test_hashtable.py | pandas/tests/libs/test_hashtable.py | from collections import namedtuple
from collections.abc import Generator
from contextlib import contextmanager
import re
import struct
import tracemalloc
import numpy as np
import pytest
from pandas._libs import hashtable as ht
import pandas as pd
import pandas._testing as tm
from pandas.core.algorithms import isin
... | 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/libs/test_join.py | pandas/tests/libs/test_join.py | import numpy as np
import pytest
from pandas._libs import join as libjoin
from pandas._libs.join import (
inner_join,
left_outer_join,
)
import pandas._testing as tm
class TestIndexer:
@pytest.mark.parametrize(
"dtype", ["int32", "int64", "float32", "float64", "object"]
)
def test_outer_... | 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/libs/test_libalgos.py | pandas/tests/libs/test_libalgos.py | from datetime import datetime
from itertools import permutations
import numpy as np
from pandas._libs import algos as libalgos
import pandas._testing as tm
def test_ensure_platform_int():
arr = np.arange(100, dtype=np.intp)
result = libalgos.ensure_platform_int(arr)
assert result is arr
def test_is_... | 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/libs/__init__.py | pandas/tests/libs/__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/libs/test_lib.py | pandas/tests/libs/test_lib.py | import pickle
import numpy as np
import pytest
from pandas._libs import (
Timedelta,
lib,
writers as libwriters,
)
from pandas.compat import IS64
from pandas import Index
import pandas._testing as tm
class TestMisc:
def test_max_len_string_array(self):
arr = a = np.array(["foo", "b", np.nan... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/api/__init__.py | pandas/api/__init__.py | """public toolkit API"""
from pandas.api import (
executors,
extensions,
indexers,
interchange,
types,
typing,
)
__all__ = [
"executors",
"extensions",
"indexers",
"interchange",
"types",
"typing",
]
| python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/api/internals.py | pandas/api/internals.py | import numpy as np
from pandas._typing import ArrayLike
from pandas import (
DataFrame,
Index,
)
from pandas.core.internals.api import _make_block
from pandas.core.internals.managers import BlockManager as _BlockManager
def create_dataframe_from_blocks(
blocks: list[tuple[ArrayLike, np.ndarray]], 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/api/typing/aliases.py | pandas/api/typing/aliases.py | from pandas._typing import (
AggFuncType,
AlignJoin,
AnyAll,
AnyArrayLike,
ArrayLike,
AstypeArg,
Axes,
Axis,
ColspaceArgType,
CompressionOptions,
CorrelationMethod,
CSVEngine,
DropKeep,
Dtype,
DtypeArg,
DtypeBackend,
DtypeObj,
ExcelWriterIfSheetExi... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/api/typing/__init__.py | pandas/api/typing/__init__.py | """
Public API classes that store intermediate results useful for type-hinting.
"""
from pandas._libs import NaTType
from pandas._libs.lib import NoDefault
from pandas._libs.missing import NAType
from pandas.core.col import Expression
from pandas.core.groupby import (
DataFrameGroupBy,
SeriesGroupBy,
)
from p... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/api/extensions/__init__.py | pandas/api/extensions/__init__.py | """
Public API for extending pandas objects.
"""
from pandas._libs.lib import no_default
from pandas.core.dtypes.base import (
ExtensionDtype,
register_extension_dtype,
)
from pandas.core.accessor import (
register_dataframe_accessor,
register_index_accessor,
register_series_accessor,
)
from 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/api/interchange/__init__.py | pandas/api/interchange/__init__.py | """
Public API for DataFrame interchange protocol.
"""
from pandas.core.interchange.dataframe_protocol import DataFrame
from pandas.core.interchange.from_dataframe import from_dataframe
__all__ = ["DataFrame", "from_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/api/executors/__init__.py | pandas/api/executors/__init__.py | """
Public API for function executor engines to be used with ``map`` and ``apply``.
"""
from pandas.core.apply import BaseExecutionEngine
__all__ = ["BaseExecutionEngine"]
| python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/api/types/__init__.py | pandas/api/types/__init__.py | """
Public toolkit API.
"""
from pandas._libs.lib import infer_dtype
from pandas.core.dtypes.api import * # noqa: F403
from pandas.core.dtypes.concat import union_categoricals
from pandas.core.dtypes.dtypes import (
CategoricalDtype,
DatetimeTZDtype,
IntervalDtype,
PeriodDtype,
)
__all__ = [
"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/api/indexers/__init__.py | pandas/api/indexers/__init__.py | """
Public API for Rolling Window Indexers.
"""
from pandas.core.indexers import check_array_indexer
from pandas.core.indexers.objects import (
BaseIndexer,
FixedForwardWindowIndexer,
VariableOffsetWindowIndexer,
)
__all__ = [
"BaseIndexer",
"FixedForwardWindowIndexer",
"VariableOffsetWindowIn... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/arrays/__init__.py | pandas/arrays/__init__.py | """
All of pandas' ExtensionArrays.
See :ref:`extending.extension-types` for more.
"""
from pandas.core.arrays import (
ArrowExtensionArray,
ArrowStringArray,
BooleanArray,
Categorical,
DatetimeArray,
FloatingArray,
IntegerArray,
IntervalArray,
NumpyExtensionArray,
PeriodArray,... | python | BSD-3-Clause | 91514c363604506f447e53380d3aa00520f1037b | 2026-01-04T14:39:36.002480Z | false |
pandas-dev/pandas | https://github.com/pandas-dev/pandas/blob/91514c363604506f447e53380d3aa00520f1037b/pandas/_libs/__init__.py | pandas/_libs/__init__.py | __all__ = [
"Interval",
"NaT",
"NaTType",
"OutOfBoundsDatetime",
"Period",
"Timedelta",
"Timestamp",
"iNaT",
]
# Below imports needs to happen first to ensure pandas top level
# module gets monkeypatched with the pandas_datetime_CAPI
# see pandas_datetime_exec in pd_datetime.c
import p... | 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.