Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/pandas/__init__.py: 100%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1from __future__ import annotations
3__docformat__ = "restructuredtext"
5# Let users know if they're missing any of our hard dependencies
6_hard_dependencies = ("numpy", "pytz", "dateutil")
7_missing_dependencies = []
9for _dependency in _hard_dependencies:
10 try:
11 __import__(_dependency)
12 except ImportError as _e: # pragma: no cover
13 _missing_dependencies.append(f"{_dependency}: {_e}")
15if _missing_dependencies: # pragma: no cover
16 raise ImportError(
17 "Unable to import required dependencies:\n" + "\n".join(_missing_dependencies)
18 )
19del _hard_dependencies, _dependency, _missing_dependencies
21# numpy compat
22from pandas.compat import is_numpy_dev as _is_numpy_dev # pyright: ignore # noqa:F401
24try:
25 from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
26except ImportError as _err: # pragma: no cover
27 _module = _err.name
28 raise ImportError(
29 f"C extension: {_module} not built. If you want to import "
30 "pandas from the source directory, you may need to run "
31 "'python setup.py build_ext --force' to build the C extensions first."
32 ) from _err
33else:
34 del _tslib, _lib, _hashtable
36from pandas._config import (
37 get_option,
38 set_option,
39 reset_option,
40 describe_option,
41 option_context,
42 options,
43)
45# let init-time option registration happen
46import pandas.core.config_init # pyright: ignore # noqa:F401
48from pandas.core.api import (
49 # dtype
50 ArrowDtype,
51 Int8Dtype,
52 Int16Dtype,
53 Int32Dtype,
54 Int64Dtype,
55 UInt8Dtype,
56 UInt16Dtype,
57 UInt32Dtype,
58 UInt64Dtype,
59 Float32Dtype,
60 Float64Dtype,
61 CategoricalDtype,
62 PeriodDtype,
63 IntervalDtype,
64 DatetimeTZDtype,
65 StringDtype,
66 BooleanDtype,
67 # missing
68 NA,
69 isna,
70 isnull,
71 notna,
72 notnull,
73 # indexes
74 Index,
75 CategoricalIndex,
76 RangeIndex,
77 MultiIndex,
78 IntervalIndex,
79 TimedeltaIndex,
80 DatetimeIndex,
81 PeriodIndex,
82 IndexSlice,
83 # tseries
84 NaT,
85 Period,
86 period_range,
87 Timedelta,
88 timedelta_range,
89 Timestamp,
90 date_range,
91 bdate_range,
92 Interval,
93 interval_range,
94 DateOffset,
95 # conversion
96 to_numeric,
97 to_datetime,
98 to_timedelta,
99 # misc
100 Flags,
101 Grouper,
102 factorize,
103 unique,
104 value_counts,
105 NamedAgg,
106 array,
107 Categorical,
108 set_eng_float_format,
109 Series,
110 DataFrame,
111)
113from pandas.core.arrays.sparse import SparseDtype
115from pandas.tseries.api import infer_freq
116from pandas.tseries import offsets
118from pandas.core.computation.api import eval
120from pandas.core.reshape.api import (
121 concat,
122 lreshape,
123 melt,
124 wide_to_long,
125 merge,
126 merge_asof,
127 merge_ordered,
128 crosstab,
129 pivot,
130 pivot_table,
131 get_dummies,
132 from_dummies,
133 cut,
134 qcut,
135)
137from pandas import api, arrays, errors, io, plotting, tseries
138from pandas import testing
139from pandas.util._print_versions import show_versions
141from pandas.io.api import (
142 # excel
143 ExcelFile,
144 ExcelWriter,
145 read_excel,
146 # parsers
147 read_csv,
148 read_fwf,
149 read_table,
150 # pickle
151 read_pickle,
152 to_pickle,
153 # pytables
154 HDFStore,
155 read_hdf,
156 # sql
157 read_sql,
158 read_sql_query,
159 read_sql_table,
160 # misc
161 read_clipboard,
162 read_parquet,
163 read_orc,
164 read_feather,
165 read_gbq,
166 read_html,
167 read_xml,
168 read_json,
169 read_stata,
170 read_sas,
171 read_spss,
172)
174from pandas.io.json._normalize import json_normalize
176from pandas.util._tester import test
178# use the closest tagged version if possible
179from pandas._version import get_versions
181v = get_versions()
182__version__ = v.get("closest-tag", v["version"])
183__git_version__ = v.get("full-revisionid")
184del get_versions, v
187# module level doc-string
188__doc__ = """
189pandas - a powerful data analysis and manipulation library for Python
190=====================================================================
192**pandas** is a Python package providing fast, flexible, and expressive data
193structures designed to make working with "relational" or "labeled" data both
194easy and intuitive. It aims to be the fundamental high-level building block for
195doing practical, **real world** data analysis in Python. Additionally, it has
196the broader goal of becoming **the most powerful and flexible open source data
197analysis / manipulation tool available in any language**. It is already well on
198its way toward this goal.
200Main Features
201-------------
202Here are just a few of the things that pandas does well:
204 - Easy handling of missing data in floating point as well as non-floating
205 point data.
206 - Size mutability: columns can be inserted and deleted from DataFrame and
207 higher dimensional objects
208 - Automatic and explicit data alignment: objects can be explicitly aligned
209 to a set of labels, or the user can simply ignore the labels and let
210 `Series`, `DataFrame`, etc. automatically align the data for you in
211 computations.
212 - Powerful, flexible group by functionality to perform split-apply-combine
213 operations on data sets, for both aggregating and transforming data.
214 - Make it easy to convert ragged, differently-indexed data in other Python
215 and NumPy data structures into DataFrame objects.
216 - Intelligent label-based slicing, fancy indexing, and subsetting of large
217 data sets.
218 - Intuitive merging and joining data sets.
219 - Flexible reshaping and pivoting of data sets.
220 - Hierarchical labeling of axes (possible to have multiple labels per tick).
221 - Robust IO tools for loading data from flat files (CSV and delimited),
222 Excel files, databases, and saving/loading data from the ultrafast HDF5
223 format.
224 - Time series-specific functionality: date range generation and frequency
225 conversion, moving window statistics, date shifting and lagging.
226"""
228# Use __all__ to let type checkers know what is part of the public API.
229# Pandas is not (yet) a py.typed library: the public API is determined
230# based on the documentation.
231__all__ = [
232 "ArrowDtype",
233 "BooleanDtype",
234 "Categorical",
235 "CategoricalDtype",
236 "CategoricalIndex",
237 "DataFrame",
238 "DateOffset",
239 "DatetimeIndex",
240 "DatetimeTZDtype",
241 "ExcelFile",
242 "ExcelWriter",
243 "Flags",
244 "Float32Dtype",
245 "Float64Dtype",
246 "Grouper",
247 "HDFStore",
248 "Index",
249 "IndexSlice",
250 "Int16Dtype",
251 "Int32Dtype",
252 "Int64Dtype",
253 "Int8Dtype",
254 "Interval",
255 "IntervalDtype",
256 "IntervalIndex",
257 "MultiIndex",
258 "NA",
259 "NaT",
260 "NamedAgg",
261 "Period",
262 "PeriodDtype",
263 "PeriodIndex",
264 "RangeIndex",
265 "Series",
266 "SparseDtype",
267 "StringDtype",
268 "Timedelta",
269 "TimedeltaIndex",
270 "Timestamp",
271 "UInt16Dtype",
272 "UInt32Dtype",
273 "UInt64Dtype",
274 "UInt8Dtype",
275 "api",
276 "array",
277 "arrays",
278 "bdate_range",
279 "concat",
280 "crosstab",
281 "cut",
282 "date_range",
283 "describe_option",
284 "errors",
285 "eval",
286 "factorize",
287 "get_dummies",
288 "from_dummies",
289 "get_option",
290 "infer_freq",
291 "interval_range",
292 "io",
293 "isna",
294 "isnull",
295 "json_normalize",
296 "lreshape",
297 "melt",
298 "merge",
299 "merge_asof",
300 "merge_ordered",
301 "notna",
302 "notnull",
303 "offsets",
304 "option_context",
305 "options",
306 "period_range",
307 "pivot",
308 "pivot_table",
309 "plotting",
310 "qcut",
311 "read_clipboard",
312 "read_csv",
313 "read_excel",
314 "read_feather",
315 "read_fwf",
316 "read_gbq",
317 "read_hdf",
318 "read_html",
319 "read_json",
320 "read_orc",
321 "read_parquet",
322 "read_pickle",
323 "read_sas",
324 "read_spss",
325 "read_sql",
326 "read_sql_query",
327 "read_sql_table",
328 "read_stata",
329 "read_table",
330 "read_xml",
331 "reset_option",
332 "set_eng_float_format",
333 "set_option",
334 "show_versions",
335 "test",
336 "testing",
337 "timedelta_range",
338 "to_datetime",
339 "to_numeric",
340 "to_pickle",
341 "to_timedelta",
342 "tseries",
343 "unique",
344 "value_counts",
345 "wide_to_long",
346]