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