/
__init__.py
140 lines (131 loc) · 2.71 KB
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
# TODO: In the future `set_option` or similar needs to run on every node
# in order to keep all pandas instances across nodes consistent
import pandas
from pandas import (
eval,
unique,
value_counts,
cut,
to_numeric,
factorize,
test,
qcut,
match,
Panel,
date_range,
period_range,
Index,
MultiIndex,
CategoricalIndex,
Series,
bdate_range,
DatetimeIndex,
Timedelta,
Timestamp,
to_timedelta,
set_eng_float_format,
set_option,
NaT,
PeriodIndex,
Categorical,
)
import threading
import os
import ray
from .. import __git_revision__, __version__
from .concat import concat
from .dataframe import DataFrame
from .datetimes import to_datetime
from .io import (
read_csv,
read_parquet,
read_json,
read_html,
read_clipboard,
read_excel,
read_hdf,
read_feather,
read_msgpack,
read_stata,
read_sas,
read_pickle,
read_sql,
)
from .reshape import get_dummies
from .general import isna, merge, pivot_table
__pandas_version__ = "0.23.4"
if pandas.__version__ != __pandas_version__:
raise ImportError(
"The pandas version installed does not match the required pandas "
"version in Modin. Please install pandas {} to use "
"Modin.".format(__pandas_version__)
)
# Set this so that Pandas doesn't try to multithread by itself
os.environ["OMP_NUM_THREADS"] = "1"
try:
if threading.current_thread().name == "MainThread":
ray.init(
redirect_output=True,
include_webui=False,
redirect_worker_output=True,
use_raylet=True,
)
except AssertionError:
pass
num_cpus = ray.global_state.cluster_resources()["CPU"]
DEFAULT_NPARTITIONS = max(4, int(num_cpus))
__all__ = [
"DataFrame",
"Series",
"read_csv",
"read_parquet",
"read_json",
"read_html",
"read_clipboard",
"read_excel",
"read_hdf",
"read_feather",
"read_msgpack",
"read_stata",
"read_sas",
"read_pickle",
"read_sql",
"concat",
"eval",
"unique",
"value_counts",
"cut",
"to_numeric",
"factorize",
"test",
"qcut",
"match",
"to_datetime",
"get_dummies",
"isna",
"merge",
"pivot_table",
"Panel",
"date_range",
"Index",
"MultiIndex",
"Series",
"bdate_range",
"period_range",
"DatetimeIndex",
"to_timedelta",
"set_eng_float_format",
"set_option",
"CategoricalIndex",
"Timedelta",
"Timestamp",
"NaT",
"PeriodIndex",
"Categorical",
"__git_revision__",
"__version__",
]
del pandas