|
18 | 18 | ) |
19 | 19 | del hard_dependencies, dependency, missing_dependencies |
20 | 20 |
|
| 21 | +from pandas._config import ( |
| 22 | + describe_option, |
| 23 | + get_option, |
| 24 | + option_context, |
| 25 | + options, |
| 26 | + reset_option, |
| 27 | + set_option, |
| 28 | +) |
| 29 | + |
21 | 30 | # numpy compat |
22 | 31 | from pandas.compat.numpy import ( |
23 | 32 | _np_version_under1p14, |
|
26 | 35 | _np_version_under1p17, |
27 | 36 | _np_version_under1p18, |
28 | 37 | ) |
| 38 | +from pandas.util._print_versions import show_versions |
| 39 | +from pandas.util._tester import test |
29 | 40 |
|
30 | | -try: |
31 | | - from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib |
32 | | -except ImportError as e: # pragma: no cover |
33 | | - # hack but overkill to use re |
34 | | - module = str(e).replace("cannot import name ", "") |
35 | | - raise ImportError( |
36 | | - f"C extension: {module} not built. If you want to import " |
37 | | - "pandas from the source directory, you may need to run " |
38 | | - "'python setup.py build_ext --inplace --force' to build the C extensions first." |
39 | | - ) |
40 | | - |
41 | | -from pandas._config import ( |
42 | | - get_option, |
43 | | - set_option, |
44 | | - reset_option, |
45 | | - describe_option, |
46 | | - option_context, |
47 | | - options, |
48 | | -) |
| 41 | +from pandas.core.dtypes.generic import ABCSparseArray |
49 | 42 |
|
50 | 43 | # let init-time option registration happen |
| 44 | +import pandas.api |
| 45 | +import pandas.arrays |
| 46 | +from pandas.core.arrays.sparse import SparseDtype |
| 47 | +from pandas.core.computation.api import eval |
51 | 48 | import pandas.core.config_init |
| 49 | +from pandas.core.reshape.api import ( |
| 50 | + concat, |
| 51 | + crosstab, |
| 52 | + cut, |
| 53 | + get_dummies, |
| 54 | + lreshape, |
| 55 | + melt, |
| 56 | + merge, |
| 57 | + merge_asof, |
| 58 | + merge_ordered, |
| 59 | + pivot, |
| 60 | + pivot_table, |
| 61 | + qcut, |
| 62 | + wide_to_long, |
| 63 | +) |
| 64 | +import pandas.testing |
52 | 65 |
|
53 | | -from pandas.core.api import ( |
54 | | - # dtype |
| 66 | +from pandas.io.json import _json_normalize as json_normalize |
| 67 | +from pandas.tseries import offsets |
| 68 | +from pandas.tseries.api import infer_freq |
| 69 | + |
| 70 | +# use the closest tagged version if possible |
| 71 | +from ._version import get_versions |
| 72 | + |
| 73 | +from pandas.core.api import ( # dtype; missing; indexes; tseries; conversion; misc |
| 74 | + NA, |
| 75 | + BooleanDtype, |
| 76 | + Categorical, |
| 77 | + CategoricalDtype, |
| 78 | + CategoricalIndex, |
| 79 | + DataFrame, |
| 80 | + DateOffset, |
| 81 | + DatetimeIndex, |
| 82 | + DatetimeTZDtype, |
| 83 | + Float64Index, |
| 84 | + Grouper, |
| 85 | + Index, |
| 86 | + IndexSlice, |
55 | 87 | Int8Dtype, |
56 | 88 | Int16Dtype, |
57 | 89 | Int32Dtype, |
58 | 90 | Int64Dtype, |
| 91 | + Int64Index, |
| 92 | + Interval, |
| 93 | + IntervalDtype, |
| 94 | + IntervalIndex, |
| 95 | + MultiIndex, |
| 96 | + NamedAgg, |
| 97 | + NaT, |
| 98 | + Period, |
| 99 | + PeriodDtype, |
| 100 | + PeriodIndex, |
| 101 | + RangeIndex, |
| 102 | + Series, |
| 103 | + StringDtype, |
| 104 | + Timedelta, |
| 105 | + TimedeltaIndex, |
| 106 | + Timestamp, |
59 | 107 | UInt8Dtype, |
60 | 108 | UInt16Dtype, |
61 | 109 | UInt32Dtype, |
62 | 110 | UInt64Dtype, |
63 | | - CategoricalDtype, |
64 | | - PeriodDtype, |
65 | | - IntervalDtype, |
66 | | - DatetimeTZDtype, |
67 | | - StringDtype, |
68 | | - BooleanDtype, |
69 | | - # missing |
70 | | - NA, |
| 111 | + UInt64Index, |
| 112 | + array, |
| 113 | + bdate_range, |
| 114 | + date_range, |
| 115 | + factorize, |
| 116 | + interval_range, |
71 | 117 | isna, |
72 | 118 | isnull, |
73 | 119 | notna, |
74 | 120 | notnull, |
75 | | - # indexes |
76 | | - Index, |
77 | | - CategoricalIndex, |
78 | | - Int64Index, |
79 | | - UInt64Index, |
80 | | - RangeIndex, |
81 | | - Float64Index, |
82 | | - MultiIndex, |
83 | | - IntervalIndex, |
84 | | - TimedeltaIndex, |
85 | | - DatetimeIndex, |
86 | | - PeriodIndex, |
87 | | - IndexSlice, |
88 | | - # tseries |
89 | | - NaT, |
90 | | - Period, |
91 | 121 | period_range, |
92 | | - Timedelta, |
| 122 | + set_eng_float_format, |
93 | 123 | timedelta_range, |
94 | | - Timestamp, |
95 | | - date_range, |
96 | | - bdate_range, |
97 | | - Interval, |
98 | | - interval_range, |
99 | | - DateOffset, |
100 | | - # conversion |
101 | | - to_numeric, |
102 | 124 | to_datetime, |
| 125 | + to_numeric, |
103 | 126 | to_timedelta, |
104 | | - # misc |
105 | | - Grouper, |
106 | | - factorize, |
107 | 127 | unique, |
108 | 128 | value_counts, |
109 | | - NamedAgg, |
110 | | - array, |
111 | | - Categorical, |
112 | | - set_eng_float_format, |
113 | | - Series, |
114 | | - DataFrame, |
115 | 129 | ) |
116 | 130 |
|
117 | | -from pandas.core.arrays.sparse import SparseDtype |
118 | | - |
119 | | -from pandas.tseries.api import infer_freq |
120 | | -from pandas.tseries import offsets |
121 | | - |
122 | | -from pandas.core.computation.api import eval |
123 | | - |
124 | | -from pandas.core.reshape.api import ( |
125 | | - concat, |
126 | | - lreshape, |
127 | | - melt, |
128 | | - wide_to_long, |
129 | | - merge, |
130 | | - merge_asof, |
131 | | - merge_ordered, |
132 | | - crosstab, |
133 | | - pivot, |
134 | | - pivot_table, |
135 | | - get_dummies, |
136 | | - cut, |
137 | | - qcut, |
138 | | -) |
139 | | - |
140 | | -import pandas.api |
141 | | -from pandas.util._print_versions import show_versions |
142 | | - |
143 | | -from pandas.io.api import ( |
144 | | - # excel |
| 131 | +from pandas.io.api import ( # excel; parsers; pickle; pytables; sql; misc |
145 | 132 | ExcelFile, |
146 | 133 | ExcelWriter, |
147 | | - read_excel, |
148 | | - # parsers |
149 | | - read_csv, |
150 | | - read_fwf, |
151 | | - read_table, |
152 | | - # pickle |
153 | | - read_pickle, |
154 | | - to_pickle, |
155 | | - # pytables |
156 | 134 | HDFStore, |
157 | | - read_hdf, |
158 | | - # sql |
159 | | - read_sql, |
160 | | - read_sql_query, |
161 | | - read_sql_table, |
162 | | - # misc |
163 | 135 | read_clipboard, |
164 | | - read_parquet, |
165 | | - read_orc, |
| 136 | + read_csv, |
| 137 | + read_excel, |
166 | 138 | read_feather, |
| 139 | + read_fwf, |
167 | 140 | read_gbq, |
| 141 | + read_hdf, |
168 | 142 | read_html, |
169 | 143 | read_json, |
170 | | - read_stata, |
| 144 | + read_orc, |
| 145 | + read_parquet, |
| 146 | + read_pickle, |
171 | 147 | read_sas, |
172 | 148 | read_spss, |
| 149 | + read_sql, |
| 150 | + read_sql_query, |
| 151 | + read_sql_table, |
| 152 | + read_stata, |
| 153 | + read_table, |
| 154 | + to_pickle, |
173 | 155 | ) |
174 | 156 |
|
175 | | -from pandas.io.json import _json_normalize as json_normalize |
176 | 157 |
|
177 | | -from pandas.util._tester import test |
178 | | -import pandas.testing |
179 | | -import pandas.arrays |
| 158 | +try: |
| 159 | + from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib |
| 160 | +except ImportError as e: # pragma: no cover |
| 161 | + # hack but overkill to use re |
| 162 | + module = str(e).replace("cannot import name ", "") |
| 163 | + raise ImportError( |
| 164 | + f"C extension: {module} not built. If you want to import " |
| 165 | + "pandas from the source directory, you may need to run " |
| 166 | + "'python setup.py build_ext --inplace --force' to build the C extensions first." |
| 167 | + ) |
180 | 168 |
|
181 | | -# use the closest tagged version if possible |
182 | | -from ._version import get_versions |
183 | 169 |
|
184 | 170 | v = get_versions() |
185 | 171 | __version__ = v.get("closest-tag", v["version"]) |
@@ -334,7 +320,6 @@ def __new__(cls, *args, **kwargs): |
334 | 320 | class __SparseArray(type): |
335 | 321 |
|
336 | 322 | from pandas.core.arrays.sparse import SparseArray as sa |
337 | | - from pandas.core.dtypes.generic import ABCSparseArray |
338 | 323 |
|
339 | 324 | SparseArray = sa |
340 | 325 |
|
|
0 commit comments