|
20 | 20 | ([1, 2], np.dtype('float32'),
|
21 | 21 | np.array([1., 2.0], dtype=np.dtype('float32'))),
|
22 | 22 | (np.array([1, 2]), None, np.array([1, 2])),
|
| 23 | +
|
23 | 24 | # String alias passes through to NumPy
|
24 | 25 | ([1, 2], 'float32', np.array([1, 2], dtype='float32')),
|
| 26 | +
|
25 | 27 | # Period alias
|
26 | 28 | ([pd.Period('2000', 'D'), pd.Period('2001', 'D')], 'Period[D]',
|
27 | 29 | period_array(['2000', '2001'], freq='D')),
|
| 30 | +
|
28 | 31 | # Period dtype
|
29 | 32 | ([pd.Period('2000', 'D')], pd.PeriodDtype('D'),
|
30 | 33 | period_array(['2000'], freq='D')),
|
| 34 | +
|
31 | 35 | # Datetime (naive)
|
32 | 36 | ([1, 2], np.dtype('datetime64[ns]'),
|
33 | 37 | np.array([1, 2], dtype='datetime64[ns]')),
|
34 | 38 | # TODO(DatetimeArray): add here
|
| 39 | +
|
35 | 40 | # Category
|
36 | 41 | (['a', 'b'], 'category', pd.Categorical(['a', 'b'])),
|
37 | 42 | (['a', 'b'], pd.CategoricalDtype(None, ordered=True),
|
38 | 43 | pd.Categorical(['a', 'b'], ordered=True)),
|
| 44 | +
|
39 | 45 | # Interval
|
40 | 46 | ([pd.Interval(1, 2), pd.Interval(3, 4)], 'interval',
|
41 | 47 | pd.IntervalArray.from_tuples([(1, 2), (3, 4)])),
|
| 48 | +
|
42 | 49 | # Sparse
|
43 | 50 | ([0, 1], 'Sparse[int64]', pd.SparseArray([0, 1], dtype='int64')),
|
| 51 | +
|
44 | 52 | # IntegerNA
|
45 | 53 | ([1, None], 'Int16', integer_array([1, None], dtype='Int16')),
|
46 | 54 | (pd.Series([1, 2]), None, np.array([1, 2], dtype=np.int64)),
|
| 55 | +
|
47 | 56 | # Index
|
48 | 57 | (pd.Index([1, 2]), None, np.array([1, 2], dtype=np.int64)),
|
| 58 | +
|
49 | 59 | # Series[EA] returns the EA
|
50 | 60 | (pd.Series(pd.Categorical(['a', 'b'], categories=['a', 'b', 'c'])),
|
51 | 61 | None,
|
52 | 62 | pd.Categorical(['a', 'b'], categories=['a', 'b', 'c'])),
|
| 63 | +
|
53 | 64 | # "3rd party" EAs work
|
54 | 65 | ([decimal.Decimal(0), decimal.Decimal(1)], 'decimal', to_decimal([0, 1])),
|
| 66 | +
|
55 | 67 | # 2D ndarrays pass through
|
56 | 68 | (np.array([[1, 2], [3, 4]]), None, np.array([[1, 2], [3, 4]])),
|
57 | 69 | ([[1, 2], [3, 4]], None, np.array([[1, 2, ], [3, 4]])),
|
| 70 | +
|
58 | 71 | # pass an ExtensionArray, but a different dtype
|
59 | 72 | (period_array(['2000', '2001'], freq='D'),
|
60 | 73 | 'category',
|
|
0 commit comments