Skip to content

Commit 208caf5

Browse files
committed
fix errors
1 parent 68f6e7a commit 208caf5

File tree

14 files changed

+42
-26
lines changed

14 files changed

+42
-26
lines changed

pandas/tests/arithmetic/conftest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
import pytest
33

44
import pandas as pd
5-
from pandas import (
5+
from pandas import RangeIndex
6+
import pandas._testing as tm
7+
from pandas.core.api import (
68
Float64Index,
79
Int64Index,
8-
RangeIndex,
910
UInt64Index,
1011
)
11-
import pandas._testing as tm
1212
from pandas.core.computation import expressions as expr
1313

1414

pandas/tests/frame/methods/test_astype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
Series,
1818
Timedelta,
1919
Timestamp,
20-
UInt64Index,
2120
concat,
2221
date_range,
2322
option_context,
2423
)
2524
import pandas._testing as tm
25+
from pandas.core.api import UInt64Index
2626
from pandas.core.arrays.integer import coerce_to_array
2727

2828

pandas/tests/indexes/datetimes/methods/test_astype.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@
1515
date_range,
1616
)
1717
import pandas._testing as tm
18-
from pandas.core.api import Int64Index
18+
from pandas.core.api import (
19+
Int64Index,
20+
UInt64Index,
21+
)
1922

2023

2124
class TestDatetimeIndex:
@@ -46,7 +49,7 @@ def test_astype(self):
4649

4750
def test_astype_uint(self):
4851
arr = date_range("2000", periods=2, name="idx")
49-
expected = pd.UInt64Index(
52+
expected = UInt64Index(
5053
np.array([946684800000000000, 946771200000000000], dtype="uint64"),
5154
name="idx",
5255
)

pandas/tests/indexes/datetimes/test_scalar_compat.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
date_range,
2020
)
2121
import pandas._testing as tm
22+
from pandas.core.api import Float64Index
2223

2324

2425
class TestDatetimeIndexOps:
@@ -332,33 +333,33 @@ def test_1700(self):
332333
dr = date_range(start=Timestamp("1710-10-01"), periods=5, freq="D")
333334
r1 = pd.Index([x.to_julian_date() for x in dr])
334335
r2 = dr.to_julian_date()
335-
assert isinstance(r2, pd.Float64Index)
336+
assert isinstance(r2, Float64Index)
336337
tm.assert_index_equal(r1, r2)
337338

338339
def test_2000(self):
339340
dr = date_range(start=Timestamp("2000-02-27"), periods=5, freq="D")
340341
r1 = pd.Index([x.to_julian_date() for x in dr])
341342
r2 = dr.to_julian_date()
342-
assert isinstance(r2, pd.Float64Index)
343+
assert isinstance(r2, Float64Index)
343344
tm.assert_index_equal(r1, r2)
344345

345346
def test_hour(self):
346347
dr = date_range(start=Timestamp("2000-02-27"), periods=5, freq="H")
347348
r1 = pd.Index([x.to_julian_date() for x in dr])
348349
r2 = dr.to_julian_date()
349-
assert isinstance(r2, pd.Float64Index)
350+
assert isinstance(r2, Float64Index)
350351
tm.assert_index_equal(r1, r2)
351352

352353
def test_minute(self):
353354
dr = date_range(start=Timestamp("2000-02-27"), periods=5, freq="T")
354355
r1 = pd.Index([x.to_julian_date() for x in dr])
355356
r2 = dr.to_julian_date()
356-
assert isinstance(r2, pd.Float64Index)
357+
assert isinstance(r2, Float64Index)
357358
tm.assert_index_equal(r1, r2)
358359

359360
def test_second(self):
360361
dr = date_range(start=Timestamp("2000-02-27"), periods=5, freq="S")
361362
r1 = pd.Index([x.to_julian_date() for x in dr])
362363
r2 = dr.to_julian_date()
363-
assert isinstance(r2, pd.Float64Index)
364+
assert isinstance(r2, Float64Index)
364365
tm.assert_index_equal(r1, r2)

pandas/tests/indexes/interval/test_formats.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
from pandas import (
55
DataFrame,
6-
Float64Index,
76
Interval,
87
IntervalIndex,
98
Series,
109
Timedelta,
1110
Timestamp,
1211
)
1312
import pandas._testing as tm
13+
from pandas.core.api import Float64Index
1414

1515

1616
class TestIntervalIndexRendering:

pandas/tests/indexes/interval/test_interval.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
timedelta_range,
2121
)
2222
import pandas._testing as tm
23+
from pandas.core.api import Float64Index
2324
import pandas.core.common as com
2425

2526

@@ -406,7 +407,7 @@ def test_maybe_convert_i8_nat(self, breaks):
406407
index = IntervalIndex.from_breaks(breaks)
407408

408409
to_convert = breaks._constructor([pd.NaT] * 3)
409-
expected = pd.Float64Index([np.nan] * 3)
410+
expected = Float64Index([np.nan] * 3)
410411
result = index._maybe_convert_i8(to_convert)
411412
tm.assert_index_equal(result, expected)
412413

pandas/tests/indexes/multi/test_analytics.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
period_range,
1010
)
1111
import pandas._testing as tm
12+
from pandas.core.api import UInt64Index
1213

1314

1415
def test_shift(idx):
@@ -174,7 +175,7 @@ def test_map(idx):
174175
index = idx
175176

176177
# we don't infer UInt64
177-
if isinstance(index, pd.UInt64Index):
178+
if isinstance(index, UInt64Index):
178179
expected = index.astype("int64")
179180
else:
180181
expected = index
@@ -198,7 +199,7 @@ def test_map_dictlike(idx, mapper):
198199
identity = mapper(idx.values, idx)
199200

200201
# we don't infer to UInt64 for a dict
201-
if isinstance(idx, pd.UInt64Index) and isinstance(identity, dict):
202+
if isinstance(idx, UInt64Index) and isinstance(identity, dict):
202203
expected = idx.astype("int64")
203204
else:
204205
expected = idx

pandas/tests/indexes/period/test_indexing.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@
2323
period_range,
2424
)
2525
import pandas._testing as tm
26-
from pandas.core.api import Int64Index
26+
from pandas.core.api import (
27+
Float64Index,
28+
Int64Index,
29+
)
2730

2831
dti4 = date_range("2016-01-01", periods=4)
2932
dti = dti4[:-1]
@@ -933,7 +936,7 @@ def test_asof_locs_mismatched_type(self):
933936
pi.asof_locs(Int64Index(pi.asi8), mask)
934937

935938
with pytest.raises(TypeError, match=msg):
936-
pi.asof_locs(pd.Float64Index(pi.asi8), mask)
939+
pi.asof_locs(Float64Index(pi.asi8), mask)
937940

938941
with pytest.raises(TypeError, match=msg):
939942
# TimedeltaIndex

pandas/tests/indexes/test_numpy_compat.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
from pandas import (
55
DatetimeIndex,
6-
Float64Index,
76
Index,
87
NumericIndex,
98
PeriodIndex,
109
TimedeltaIndex,
1110
)
1211
import pandas._testing as tm
12+
from pandas.core.api import Float64Index
1313
from pandas.core.indexes.datetimelike import DatetimeIndexOpsMixin
1414

1515

pandas/tests/indexes/timedeltas/methods/test_astype.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,18 @@
55

66
import pandas as pd
77
from pandas import (
8-
Float64Index,
98
Index,
10-
Int64Index,
119
NaT,
1210
Timedelta,
1311
TimedeltaIndex,
1412
timedelta_range,
1513
)
1614
import pandas._testing as tm
15+
from pandas.core.api import (
16+
Float64Index,
17+
Int64Index,
18+
UInt64Index,
19+
)
1720

1821

1922
class TestTimedeltaIndex:
@@ -74,7 +77,7 @@ def test_astype(self):
7477

7578
def test_astype_uint(self):
7679
arr = timedelta_range("1H", periods=2)
77-
expected = pd.UInt64Index(
80+
expected = UInt64Index(
7881
np.array([3600000000000, 90000000000000], dtype="uint64")
7982
)
8083
with tm.assert_produces_warning(FutureWarning):

pandas/tests/indexing/common.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,15 @@
55

66
from pandas import (
77
DataFrame,
8-
Float64Index,
98
MultiIndex,
109
Series,
11-
UInt64Index,
1210
date_range,
1311
)
1412
import pandas._testing as tm
13+
from pandas.core.api import (
14+
Float64Index,
15+
UInt64Index,
16+
)
1517

1618

1719
def _mklbl(prefix, n):

pandas/tests/indexing/test_indexing.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
timedelta_range,
2626
)
2727
import pandas._testing as tm
28+
from pandas.core.api import Float64Index
2829
from pandas.tests.indexing.common import _mklbl
2930
from pandas.tests.indexing.test_floats import gen_obj
3031

@@ -143,7 +144,7 @@ def test_inf_upcast(self):
143144
assert df.loc[np.inf, 0] == 3
144145

145146
result = df.index
146-
expected = pd.Float64Index([1, 2, np.inf])
147+
expected = Float64Index([1, 2, np.inf])
147148
tm.assert_index_equal(result, expected)
148149

149150
def test_setitem_dtype_upcast(self):

pandas/tests/indexing/test_loc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
)
3737
import pandas._testing as tm
3838
from pandas.api.types import is_scalar
39+
from pandas.core.api import Float64Index
3940
from pandas.tests.indexing.common import Base
4041

4142

@@ -1838,7 +1839,7 @@ def test_loc_setitem_with_expansion_inf_upcast_empty(self):
18381839
df.loc[0, np.inf] = 3
18391840

18401841
result = df.columns
1841-
expected = pd.Float64Index([0, 1, np.inf])
1842+
expected = Float64Index([0, 1, np.inf])
18421843
tm.assert_index_equal(result, expected)
18431844

18441845
@pytest.mark.filterwarnings("ignore:indexing past lexsort depth")

pandas/tests/io/test_stata.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1955,7 +1955,7 @@ def test_chunked_categorical_partial(dirpath):
19551955
if i < 2:
19561956
idx = pd.Index(["a", "b"])
19571957
else:
1958-
idx = pd.Float64Index([3.0])
1958+
idx = pd.Index([3.0], dtype="float64")
19591959
tm.assert_index_equal(block.cats.cat.categories, idx)
19601960
with tm.assert_produces_warning(CategoricalConversionWarning):
19611961
with StataReader(dta_file, chunksize=5) as reader:

0 commit comments

Comments
 (0)