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