after_merge stringlengths 28 79.6k | before_merge stringlengths 20 79.6k | url stringlengths 38 71 | full_traceback stringlengths 43 922k | traceback_type stringclasses 555
values |
|---|---|---|---|---|
def __call__(self, left, right):
empty_left, empty_right = self._make_data(left), self._make_data(right)
# this `merge` will check whether the combination of those arguments is valid
merged = empty_left.merge(
empty_right,
how=self.how,
on=self.on,
left_on=self.left_on,
... | def __call__(self, left, right):
empty_left, empty_right = build_empty_df(left.dtypes), build_empty_df(right.dtypes)
# left should have values to keep columns order.
gen_left_data = [np.random.rand(1).astype(dt)[0] for dt in left.dtypes]
empty_left = empty_left.append(
pd.DataFrame([gen_left_dat... | https://github.com/mars-project/mars/issues/1110 | In [4]: df = pd.DataFrame({'a': np.arange(10), 'b': np.random.rand(10)})
In [5]: df2 = df.copy()
In [6]: df2.set_index('a', inplace=True)
In [7]: df2
Out[7]:
b
a
0 0.984265
1 0.544014
2 0.592392
3 0.269762
4 0.236130
5 0.846061
6 0.308780
7 0.604834
8 0.973824
9 0.867099
In [8]: df.merge(df2, on='a') # c... | KeyError |
def build_empty_df(dtypes, index=None):
columns = dtypes.index
df = pd.DataFrame(columns=columns, index=index)
for c, d in zip(columns, dtypes):
df[c] = pd.Series(dtype=d, index=index)
return df
| def build_empty_df(dtypes, index=None):
columns = dtypes.index
df = pd.DataFrame(columns=columns)
for c, d in zip(columns, dtypes):
df[c] = pd.Series(dtype=d, index=index)
return df
| https://github.com/mars-project/mars/issues/1110 | In [4]: df = pd.DataFrame({'a': np.arange(10), 'b': np.random.rand(10)})
In [5]: df2 = df.copy()
In [6]: df2.set_index('a', inplace=True)
In [7]: df2
Out[7]:
b
a
0 0.984265
1 0.544014
2 0.592392
3 0.269762
4 0.236130
5 0.846061
6 0.308780
7 0.604834
8 0.973824
9 0.867099
In [8]: df.merge(df2, on='a') # c... | KeyError |
def __init__(self, input_=None, index=None, dtypes=None, gpu=None, sparse=None, **kw):
super().__init__(
_input=input_,
_index=index,
_dtypes=dtypes,
_gpu=gpu,
_sparse=sparse,
_object_type=ObjectType.dataframe,
**kw,
)
| def __init__(
self, index=None, dtypes=None, from_1d_tensors=None, gpu=None, sparse=None, **kw
):
super().__init__(
_index=index,
_dtypes=dtypes,
_from_1d_tensors=from_1d_tensors,
_gpu=gpu,
_sparse=sparse,
_object_type=ObjectType.dataframe,
**kw,
)
| https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def _set_inputs(self, inputs):
super()._set_inputs(inputs)
inputs_iter = iter(self._inputs)
if self._input is not None:
if not isinstance(self._input, dict):
self._input = next(inputs_iter)
else:
# check each value for input
new_input = OrderedDict()
... | def _set_inputs(self, inputs):
super()._set_inputs(inputs)
if not self._from_1d_tensors:
self._input = inputs[0]
if self._index is not None:
self._index = inputs[-1]
| https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def __call__(self, input_tensor, index, columns):
if isinstance(input_tensor, dict):
return self._call_input_1d_tileables(input_tensor, index, columns)
else:
return self._call_input_tensor(input_tensor, index, columns)
| def __call__(self, input_tensor, index, columns):
if self._from_1d_tensors:
return self._call_input_1d_tensors(input_tensor, index, columns)
else:
return self._call_input_tensor(input_tensor, index, columns)
| https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def tile(cls, op):
# make sure all tensor have known chunk shapes
check_chunks_unknown_shape(op.inputs, TilesError)
if isinstance(op.input, dict):
return cls._tile_input_1d_tileables(op)
else:
return cls._tile_input_tensor(op)
| def tile(cls, op):
# make sure all tensor have known chunk shapes
check_chunks_unknown_shape(op.inputs, TilesError)
if op.from_1d_tensors:
return cls._tile_input_1d_tensors(op)
else:
return cls._tile_input_tensor(op)
| https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def execute(cls, ctx, op):
chunk = op.outputs[0]
if isinstance(op.input, dict):
d = OrderedDict()
for k, v in op.input.items():
if hasattr(v, "key"):
d[k] = ctx[v.key]
else:
d[k] = v
if op.index is not None:
index_data ... | def execute(cls, ctx, op):
chunk = op.outputs[0]
if op.from_1d_tensors:
d = OrderedDict()
tensors = [ctx[inp.key] for inp in op.inputs]
if op.index is not None:
tensors_data, index_data = tensors[:-1], tensors[-1]
else:
tensors_data = tensors
... | https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def dataframe_from_tensor(tensor, index=None, columns=None, gpu=None, sparse=False):
if tensor.ndim > 2 or tensor.ndim <= 0:
raise TypeError(
"Not support create DataFrame from {0} dims tensor", format(tensor.ndim)
)
try:
col_num = tensor.shape[1]
except IndexError:
... | def dataframe_from_tensor(tensor, index=None, columns=None, gpu=None, sparse=False):
if tensor.ndim > 2 or tensor.ndim <= 0:
raise TypeError(
"Not support create DataFrame from {0} dims tensor", format(tensor.ndim)
)
try:
col_num = tensor.shape[1]
except IndexError:
... | https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def __init__(
self,
data=None,
index=None,
columns=None,
dtype=None,
copy=False,
chunk_size=None,
gpu=None,
sparse=None,
):
if isinstance(data, TENSOR_TYPE):
if chunk_size is not None:
data = data.rechunk(chunk_size)
df = dataframe_from_tensor(
... | def __init__(
self,
data=None,
index=None,
columns=None,
dtype=None,
copy=False,
chunk_size=None,
gpu=None,
sparse=None,
):
if isinstance(data, TENSOR_TYPE):
if chunk_size is not None:
data = data.rechunk(chunk_size)
df = dataframe_from_tensor(
... | https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def _submit_operand_to_execute(self):
self._semaphore.acquire()
self._queue.wait()
if self._has_error.is_set():
# error happens, ignore
return
with self._lock:
to_submit_op = self._queue.pop(0)
assert to_submit_op.key not in self._submitted_op_keys
self._submitted_op_ke... | def _submit_operand_to_execute(self):
self._semaphore.acquire()
self._queue.wait()
if self._has_error.is_set():
# error happens, ignore
return
to_submit_op = self._queue.pop(0)
assert to_submit_op.key not in self._submitted_op_keys
self._submitted_op_keys.add(to_submit_op.key)
... | https://github.com/mars-project/mars/issues/1097 | In [7]: md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3])}).execute()
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-7-ec6db392e00f> in <module>
----> 1 md.DataFrame({'a': '1', 'b': md.Series([1, 2, 3... | ValueError |
def validate_axis(axis, tileable=None):
if axis == "index":
axis = 0
elif axis == "columns":
axis = 1
illegal = False
try:
axis = operator.index(axis)
if axis < 0 or (tileable is not None and axis >= tileable.ndim):
illegal = True
except TypeError:
... | def validate_axis(axis, tileable=None):
if axis == "index":
axis = 0
elif axis == "columns":
axis = 1
illegal = False
try:
axis = operator.index(axis)
if axis < 0 or (tileable and axis >= tileable.ndim):
illegal = True
except TypeError:
illegal = ... | https://github.com/mars-project/mars/issues/1090 | import mars.dataframe as md
df = md.read_csv('/home/xuye.qin/ml-20m/ratings.csv')
df.sort_values(by='rating')
Traceback (most recent call last):
File "/home/xuye.qin/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<... | ValueError |
def execute(cls, ctx, op):
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
a = xp.concatenate(inputs, axis=op.axis)
p = len(inputs)
assert a.shape[op.axis] == p**2
if op.kind is not ... | def execute(cls, ctx, op):
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
a = xp.concatenate(inputs, axis=op.axis)
p = len(inputs)
assert a.shape[op.axis] == p**2
if op.kind is not ... | https://github.com/mars-project/mars/issues/1090 | import mars.dataframe as md
df = md.read_csv('/home/xuye.qin/ml-20m/ratings.csv')
df.sort_values(by='rating')
Traceback (most recent call last):
File "/home/xuye.qin/miniconda3/lib/python3.7/site-packages/IPython/core/interactiveshell.py", line 3296, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<... | ValueError |
def tile_with_mask(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
if isinstance(op.mask, SERIES_TYPE):
mask = op.inputs[1]
nsplits, out_shape, df_chunks, mask_chunks = align_dataframe_series(
in_df, mask, axis="index"
)
out_chunk_inde... | def tile_with_mask(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
if isinstance(op.mask, SERIES_TYPE):
mask = op.inputs[1]
nsplits, out_shape, df_chunks, mask_chunks = align_dataframe_series(
in_df, mask, axis="index"
)
out_chunk_inde... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def tile(cls, op):
df = op.outputs[0]
left = build_concatenated_rows_frame(op.inputs[0])
right = build_concatenated_rows_frame(op.inputs[1])
if len(left.chunks) == 1 or len(right.chunks) == 1:
return cls._tile_one_chunk(op, left, right)
left_row_chunk_size = left.chunk_shape[0]
right_r... | def tile(cls, op):
df = op.outputs[0]
left = build_concatenated_rows_frame(op.inputs[0])
right = build_concatenated_rows_frame(op.inputs[1])
# left and right now are guaranteed only chunked along index axis, not column axis.
if left.chunk_shape[1] > 1:
check_chunks_unknown_shape([left], Til... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def set_operand_state(self, op_key, state):
if (
op_key not in self._operand_infos
and self._chunk_graph_builder.iterative_chunk_graphs
and state == OperandState.FREED
):
# if iterative tiling is entered,
# the `_operand_infos` will be a completely new one,
# in t... | def set_operand_state(self, op_key, state):
if (
op_key not in self._operand_infos
and self._chunk_graph_builder.iterative_chunk_graphs
and state == OperandState.FREED
):
# if iterative tiling is entered,
# the `_operand_infos` will be a completely new one,
# in t... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def set_operand_worker(self, op_key, worker):
if op_key not in self._operand_infos and self.state in GraphState.TERMINATED_STATES:
# if operand has been cleared in iterative tiling and execute again in another
# graph, just ignore it.
return
op_info = self._operand_infos[op_key]
if w... | def set_operand_worker(self, op_key, worker):
op_info = self._operand_infos[op_key]
if worker:
op_info["worker"] = worker
else:
try:
del op_info["worker"]
except KeyError:
pass
self._graph_meta_ref.update_op_worker(
op_key, op_info["op_name"], work... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def append_graph(self, graph_key, op_info):
from ..graph import GraphActor
if not self._is_terminal:
self._is_terminal = op_info.get("is_terminal")
graph_ref = self.get_actor_ref(GraphActor.gen_uid(self._session_id, graph_key))
self._graph_refs.append(graph_ref)
self._pred_keys.update(op_in... | def append_graph(self, graph_key, op_info):
from ..graph import GraphActor
if not self._is_terminal:
self._is_terminal = op_info.get("is_terminal")
graph_ref = self.get_actor_ref(GraphActor.gen_uid(self._session_id, graph_key))
self._graph_refs.append(graph_ref)
self._pred_keys.update(op_in... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def submit_to_worker(self, worker, data_metas):
# worker assigned, submit job
if self.state in (OperandState.CANCELLED, OperandState.CANCELLING):
self.start_operand()
return
if self.state == OperandState.RUNNING:
# already running
return
self.worker = worker
target_... | def submit_to_worker(self, worker, data_metas):
# worker assigned, submit job
if self.state in (OperandState.CANCELLED, OperandState.CANCELLING):
self.start_operand()
return
if self.state == OperandState.RUNNING:
# already running
return
self.worker = worker
target_... | https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def _add_finished_terminal(self, final_state=None, exc=None):
futures = []
for graph_ref in self._graph_refs:
if graph_ref.reload_state() in (GraphState.RUNNING, GraphState.CANCELLING):
futures.append(
graph_ref.add_finished_terminal(
self._op_key,
... | def _add_finished_terminal(self, final_state=None, exc=None):
futures = []
for graph_ref in self._graph_refs:
futures.append(
graph_ref.add_finished_terminal(
self._op_key, final_state=final_state, exc=exc, _tell=True, _wait=False
)
)
return futures
| https://github.com/mars-project/mars/issues/1055 | Traceback (most recent call last):
File "mars/serialize/pbserializer.pyx", line 527, in mars.serialize.pbserializer.ProtobufSerializeProvider.serialize_field
field_obj = getattr(obj, tag)
AttributeError: index_value | AttributeError |
def tile(cls, op):
from ..datasource import arange
in_tensor = astensor(op.input)
flattened = in_tensor.astype(bool).flatten()
recursive_tile(flattened)
indices = arange(flattened.size, dtype=np.intp, chunk_size=flattened.nsplits)
indices = indices[flattened]
dim_indices = unravel_index(in... | def tile(cls, op):
from ..datasource import arange
in_tensor = op.input
flattened = in_tensor.astype(bool).flatten()
recursive_tile(flattened)
indices = arange(flattened.size, dtype=np.intp, chunk_size=flattened.nsplits)
indices = indices[flattened]
dim_indices = unravel_index(indices, in_... | https://github.com/mars-project/mars/issues/953 | runfile('C:/Users/Lenovo/Desktop/test/mars/test.py', wdir='C:/Users/Lenovo/Desktop/test/mars')
Traceback (most recent call last):
File "C:\Users\Lenovo\Desktop\test\mars\test.py", line 25, in <module>
sess.run(mt.where( x > 5 ))
File "D:\ProgramData\Anaconda3\lib\site-packages\mars\session.py", line 183, in run
resul... | TypeError |
def execute(cls, ctx, op):
xdf = cudf if op.gpu else pd
out_df = op.outputs[0]
csv_kwargs = op.extra_params.copy()
with open_file(
op.path, compression=op.compression, storage_options=op.storage_options
) as f:
if op.compression is not None:
# As we specify names and dty... | def execute(cls, ctx, op):
xdf = cudf if op.gpu else pd
out_df = op.outputs[0]
csv_kwargs = op.extra_params.copy()
with open_file(
op.path, compression=op.compression, storage_options=op.storage_options
) as f:
if op.compression is not None:
# As we specify names and dty... | https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def __init__(
self, func=None, by=None, as_index=None, sort=None, method=None, stage=None, **kw
):
super(DataFrameGroupByAgg, self).__init__(
_func=func,
_by=by,
_as_index=as_index,
_sort=sort,
_method=method,
_stage=stage,
_object_type=ObjectType.datafram... | def __init__(self, func=None, by=None, as_index=None, method=None, stage=None, **kw):
super(DataFrameGroupByAgg, self).__init__(
_func=func,
_by=by,
_as_index=as_index,
_method=method,
_stage=stage,
_object_type=ObjectType.dataframe,
**kw,
)
| https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def _execute_map(cls, df, op):
if isinstance(op.func, (six.string_types, dict)):
return df.groupby(op.by, as_index=op.as_index, sort=False).agg(op.func)
else:
raise NotImplementedError
| def _execute_map(cls, df, op):
if isinstance(op.func, (six.string_types, dict)):
return df.groupby(op.by, as_index=op.as_index).agg(op.func)
else:
raise NotImplementedError
| https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def _execute_combine(cls, df, op):
if isinstance(op.func, (six.string_types, dict)):
return df.groupby(level=0, as_index=op.as_index, sort=op.sort).agg(op.func)
else:
raise NotImplementedError
| def _execute_combine(cls, df, op):
if isinstance(op.func, (six.string_types, dict)):
return df.groupby(op.by, as_index=op.as_index).agg(op.func)
else:
raise NotImplementedError
| https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def agg(groupby, func, method="tree"):
"""
Aggregate using one or more operations on grouped data.
:param groupby: Groupby data.
:param func: Aggregation functions.
:param method: 'shuffle' or 'tree', 'tree' method provide a better performance, 'shuffle' is recommended
if aggregated result is ve... | def agg(groupby, func, method="tree"):
"""
Aggregate using one or more operations on grouped data.
:param groupby: Groupby data.
:param func: Aggregation functions.
:param method: 'shuffle' or 'tree', 'tree' method provide a better performance, 'shuffle' is recommended
if aggregated result is ve... | https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def __init__(
self, by=None, as_index=None, sort=None, object_type=ObjectType.groupby, **kw
):
super(DataFrameGroupByOperand, self).__init__(
_by=by, _as_index=as_index, _sort=sort, _object_type=object_type, **kw
)
| def __init__(self, by=None, as_index=None, object_type=ObjectType.groupby, **kw):
super(DataFrameGroupByOperand, self).__init__(
_by=by, _as_index=as_index, _object_type=object_type, **kw
)
| https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def dataframe_groupby(df, by, as_index=True, sort=True):
if isinstance(by, six.string_types):
by = [by]
op = DataFrameGroupByOperand(by=by, as_index=as_index, sort=sort)
return op(df)
| def dataframe_groupby(df, by, as_index=True):
if isinstance(by, six.string_types):
by = [by]
op = DataFrameGroupByOperand(by=by, as_index=as_index)
return op(df)
| https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def execute(cls, ctx, op):
def _base_concat(chunk, inputs):
# auto generated concat when executing a DataFrame, Series or Index
if chunk.op.object_type == ObjectType.dataframe:
return _auto_concat_dataframe_chunks(chunk, inputs)
elif chunk.op.object_type == ObjectType.series:
... | def execute(cls, ctx, op):
def _base_concat(chunk, inputs):
# auto generated concat when executing a DataFrame, Series or Index
if chunk.op.object_type == ObjectType.dataframe:
return _auto_concat_dataframe_chunks(chunk, inputs)
elif chunk.op.object_type == ObjectType.series:
... | https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def _auto_concat_dataframe_chunks(chunk, inputs):
if chunk.op.axis is not None:
return pd.concat(inputs, axis=op.axis)
# auto generated concat when executing a DataFrame
n_rows = max(inp.index[0] for inp in chunk.inputs) + 1
n_cols = int(len(inputs) // n_rows)
assert n_rows * n_cols == len(i... | def _auto_concat_dataframe_chunks(chunk, inputs):
if chunk.op.axis is not None:
return pd.concat(inputs, axis=op.axis)
# auto generated concat when executing a DataFrame
n_rows = max(inp.index[0] for inp in chunk.inputs) + 1
n_cols = int(len(inputs) // n_rows)
assert n_rows * n_cols == len(i... | https://github.com/mars-project/mars/issues/852 | In [5]: df = md.read_csv('/home/xuye.qin/kaisheng.hks/G1_1e8_1e2_0_0.csv', gpu=True)
In [6]: _ = df.execute()
---------------------------------------------------------------------------
RuntimeError Traceback (most recent call last)
<ipython-input-6-bdc0e119412a> in <module>
----> 1 _ = df... | RuntimeError |
def _create_chunk(self, output_idx, index, **kw):
inputs = self.inputs
if kw.get("index_value", None) is None and inputs[0].index_value is not None:
input_index_value = inputs[0].index_value
index_min_max = self.index_min_max
if index_min_max is not None:
kw["index_value"] = ... | def _create_chunk(self, output_idx, index, **kw):
inputs = self.inputs
if kw.get("index_value", None) is None and inputs[0].index_value is not None:
input_index_value = inputs[0].index_value
index_min_max = self.index_min_max
if index_min_max is not None:
kw["index_value"] = ... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _create_chunk(self, output_idx, index, **kw):
inputs = self.inputs
if (
kw.get("index_value", None) is None
and inputs[0].inputs[0].index_value is not None
):
index_align_map_chunks = inputs[0].inputs
if index_align_map_chunks[0].op.index_min_max is not None:
... | def _create_chunk(self, output_idx, index, **kw):
inputs = self.inputs
if (
kw.get("index_value", None) is None
and inputs[0].inputs[0].index_value is not None
):
index_align_map_chunks = inputs[0].inputs
if index_align_map_chunks[0].op.index_min_max is not None:
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _get_chunk_index_min_max(index_chunks):
chunk_index_min_max = []
for chunk in index_chunks:
min_val = chunk.min_val
min_val_close = chunk.min_val_close
max_val = chunk.max_val
max_val_close = chunk.max_val_close
if min_val is None or max_val is None:
retur... | def _get_chunk_index_min_max(index, index_chunks):
chunk_index_min_max = []
for chunk in index_chunks:
min_val = chunk.min_val
min_val_close = chunk.min_val_close
max_val = chunk.max_val
max_val_close = chunk.max_val_close
if min_val is None or max_val is None:
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _need_align_map(
input_chunk,
index_min_max,
column_min_max,
dummy_index_splits=False,
dummy_column_splits=False,
):
if not dummy_index_splits:
assert not pd.isnull(index_min_max[0]) and not pd.isnull(index_min_max[2])
if isinstance(input_chunk, SERIES_CHUNK_TYPE):
if inp... | def _need_align_map(
input_chunk,
index_min_max,
column_min_max,
dummy_index_splits=False,
dummy_column_splits=False,
):
if not dummy_index_splits:
assert not pd.isnull(index_min_max[0]) and not pd.isnull(index_min_max[2])
if isinstance(input_chunk, SERIES_CHUNK_TYPE):
if inp... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _calc_axis_splits(left_axis, right_axis, left_axis_chunks, right_axis_chunks):
if _axis_need_shuffle(left_axis, right_axis, left_axis_chunks, right_axis_chunks):
# do shuffle
out_chunk_size = max(len(left_axis_chunks), len(right_axis_chunks))
return None, [np.nan for _ in range(out_chunk... | def _calc_axis_splits(left_axis, right_axis, left_axis_chunks, right_axis_chunks):
if _axis_need_shuffle(left_axis, right_axis, left_axis_chunks, right_axis_chunks):
# do shuffle
out_chunk_size = max(len(left_axis_chunks), len(right_axis_chunks))
return None, [np.nan for _ in range(out_chunk... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _gen_dataframe_chunks(splits, out_shape, left_or_right, df):
out_chunks = []
if splits.all_axes_can_split():
# no shuffle for all axes
kw = {
"index_shuffle_size": -1 if splits[0].isdummy() else None,
"column_shuffle_size": -1 if splits[1].isdummy() else None,
... | def _gen_dataframe_chunks(splits, out_shape, left_or_right, df):
out_chunks = []
if splits.all_axes_can_split():
# no shuffle for all axes
kw = {
"index_shuffle_size": -1 if splits[0].isdummy() else None,
"column_shuffle_size": -1 if splits[1].isdummy() else None,
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def align_dataframe_dataframe(left, right):
left_index_chunks = [c.index_value for c in left.cix[:, 0]]
left_columns_chunks = [c.columns_value for c in left.cix[0, :]]
right_index_chunks = [c.index_value for c in right.cix[:, 0]]
right_columns_chunks = [c.columns_value for c in right.cix[0, :]]
ind... | def align_dataframe_dataframe(left, right):
left_index_chunks = [c.index_value for c in left.cix[:, 0]]
left_columns_chunks = [c.columns for c in left.cix[0, :]]
right_index_chunks = [c.index_value for c in right.cix[:, 0]]
right_columns_chunks = [c.columns for c in right.cix[0, :]]
index_splits, i... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def align_dataframe_series(left, right, axis="columns"):
if axis == "columns" or axis == 1:
left_columns_chunks = [c.columns_value for c in left.cix[0, :]]
right_index_chunks = [c.index_value for c in right.chunks]
index_splits, index_nsplits = _calc_axis_splits(
left.columns_val... | def align_dataframe_series(left, right, axis="columns"):
if axis == "columns" or axis == 1:
left_columns_chunks = [c.columns for c in left.cix[0, :]]
right_index_chunks = [c.index_value for c in right.chunks]
index_splits, index_nsplits = _calc_axis_splits(
left.columns, right.in... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def add(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameAdd(axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other)
return op(df, other)
| def add(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameAdd(axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other)
return op(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def radd(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameAdd(axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df)
return op.rcall(df, other)
| def radd(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameAdd(axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df)
return op.rcall(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _tile_both_dataframes(cls, op):
# if both of the inputs are DataFrames, axis is just ignored
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, left_chunks, right_chunks = align_dataframe_dataframe(
left, right
)
out_chunk_indexes = itertools.product(*(range(s) for ... | def _tile_both_dataframes(cls, op):
# if both of the inputs are DataFrames, axis is just ignored
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, left_chunks, right_chunks = align_dataframe_dataframe(
left, right
)
out_chunk_indexes = itertools.product(*(range(s) for ... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _tile_dataframe_series(cls, op):
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, left_chunks, right_chunks = align_dataframe_series(
left, right, axis=op.axis
)
out_chunk_indexes = itertools.product(*(range(s) for s in out_shape))
out_chunks = []
for out_idx... | def _tile_dataframe_series(cls, op):
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, left_chunks, right_chunks = align_dataframe_series(
left, right, axis=op.axis
)
out_chunk_indexes = itertools.product(*(range(s) for s in out_shape))
out_chunks = []
for out_idx... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _tile_series_dataframe(cls, op):
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, right_chunks, left_chunks = align_dataframe_series(
right, left, axis=op.axis
)
out_chunk_indexes = itertools.product(*(range(s) for s in out_shape))
out_chunks = []
for out_idx... | def _tile_series_dataframe(cls, op):
left, right = op.lhs, op.rhs
df = op.outputs[0]
nsplits, out_shape, right_chunks, left_chunks = align_dataframe_series(
right, left, axis=op.axis
)
out_chunk_indexes = itertools.product(*(range(s) for s in out_shape))
out_chunks = []
for out_idx... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _tile_scalar(cls, op):
tileable = op.rhs if np.isscalar(op.lhs) else op.lhs
df = op.outputs[0]
out_chunks = []
for chunk in tileable.chunks:
out_op = op.copy().reset_key()
if isinstance(chunk, DATAFRAME_CHUNK_TYPE):
out_chunk = out_op.new_chunk(
[chunk],
... | def _tile_scalar(cls, op):
tileable = op.rhs if np.isscalar(op.lhs) else op.lhs
df = op.outputs[0]
out_chunks = []
for chunk in tileable.chunks:
out_op = op.copy().reset_key()
if isinstance(chunk, DATAFRAME_CHUNK_TYPE):
out_chunk = out_op.new_chunk(
[chunk],
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _calc_properties(cls, x1, x2=None, axis="columns"):
if isinstance(x1, (DATAFRAME_TYPE, DATAFRAME_CHUNK_TYPE)) and (
x2 is None or np.isscalar(x2)
):
# FIXME infer the dtypes of result df properly
return {
"shape": x1.shape,
"dtypes": x1.dtypes,
"co... | def _calc_properties(cls, x1, x2=None, axis="columns"):
if isinstance(x1, (DATAFRAME_TYPE, DATAFRAME_CHUNK_TYPE)) and (
x2 is None or np.isscalar(x2)
):
# FIXME infer the dtypes of result df properly
return {
"shape": x1.shape,
"dtypes": x1.dtypes,
"co... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, x1, x2):
x1 = self._process_input(x1)
x2 = self._process_input(x2)
if isinstance(x1, SERIES_TYPE) and isinstance(x2, DATAFRAME_TYPE):
# reject invoking series's op on dataframe
raise NotImplementedError
return self._call(x1, x2)
| def __call__(self, x1, x2):
if isinstance(x1, SERIES_TYPE) and isinstance(x2, DATAFRAME_TYPE):
# reject invokeing series's op on dataframe
raise NotImplementedError
return self._call(x1, x2)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def rcall(self, x1, x2):
x1 = self._process_input(x1)
x2 = self._process_input(x2)
if isinstance(x1, SERIES_TYPE) and isinstance(x2, DATAFRAME_TYPE):
# reject invoking series's op on dataframe
raise NotImplementedError
return self._call(x2, x1)
| def rcall(self, x1, x2):
if isinstance(x1, SERIES_TYPE) and isinstance(x2, DATAFRAME_TYPE):
# reject invokeing series's op on dataframe
raise NotImplementedError
return self._call(x2, x1)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
for in_chunk in in_df.chunks:
out_op = op.copy().reset_key()
out_chunk = out_op.new_chunk(
[in_chunk],
shape=in_chunk.shape,
index=in_chunk.index,
index_value=i... | def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
for in_chunk in in_df.chunks:
out_op = op.copy().reset_key()
out_chunk = out_op.new_chunk(
[in_chunk],
shape=in_chunk.shape,
index=in_chunk.index,
index_value=i... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, df):
return self.new_dataframe(
[df],
df.shape,
dtypes=df.dtypes,
columns_value=df.columns_value,
index_value=df.index_value,
)
| def __call__(self, df):
return self.new_dataframe(
[df],
df.shape,
dtypes=df.dtypes,
columns_value=df.columns,
index_value=df.index_value,
)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def floordiv(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameFloorDiv(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| def floordiv(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameFloorDiv(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def rfloordiv(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameFloorDiv(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| def rfloordiv(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameFloorDiv(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def subtract(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameSubtract(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| def subtract(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameSubtract(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def rsubtract(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameSubtract(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| def rsubtract(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameSubtract(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def truediv(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameTrueDiv(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| def truediv(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameTrueDiv(
axis=axis, level=level, fill_value=fill_value, lhs=df, rhs=other
)
return op(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def rtruediv(df, other, axis="columns", level=None, fill_value=None):
op = DataFrameTrueDiv(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| def rtruediv(df, other, axis="columns", level=None, fill_value=None):
other = wrap_sequence(other)
op = DataFrameTrueDiv(
axis=axis, level=level, fill_value=fill_value, lhs=other, rhs=df
)
return op.rcall(df, other)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, obj):
if isinstance(obj, DATAFRAME_TYPE):
self._object_type = ObjectType.dataframe
return self.new_dataframe(
[obj],
shape=obj.shape,
dtypes=obj.dtypes,
index_value=obj.index_value,
columns_value=obj.columns_value,
... | def __call__(self, obj):
if isinstance(obj, DATAFRAME_TYPE):
self._object_type = ObjectType.dataframe
return self.new_dataframe(
[obj],
shape=obj.shape,
dtypes=obj.dtypes,
index_value=obj.index_value,
columns_value=obj.columns,
)
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def params(self):
# params return the properties which useful to rebuild a new chunk
return {
"shape": self.shape,
"dtypes": self.dtypes,
"index": self.index,
"index_value": self.index_value,
"columns_value": self.columns_value,
}
| def params(self):
# params return the properties which useful to rebuild a new chunk
return {
"shape": self.shape,
"dtypes": self.dtypes,
"index": self.index,
"index_value": self.index_value,
"columns_value": self.columns,
}
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def params(self):
# params return the properties which useful to rebuild a new tileable object
return {
"shape": self.shape,
"dtypes": self.dtypes,
"index_value": self.index_value,
"columns_value": self.columns_value,
}
| def params(self):
# params return the properties which useful to rebuild a new tileable object
return {
"shape": self.shape,
"dtypes": self.dtypes,
"index_value": self.index_value,
"columns_value": self.columns,
}
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
df = op.outputs[0]
raw_df = op.data
memory_usage = raw_df.memory_usage(index=False, deep=True)
chunk_size = df.extra_params.raw_chunk_size or options.tensor.chunk_size
chunk_size = decide_dataframe_chunk_sizes(df.shape, chunk_size, memory_usage)
chunk_size_idxes = (range(len(... | def tile(cls, op):
df = op.outputs[0]
raw_df = op.data
memory_usage = raw_df.memory_usage(index=False, deep=True)
chunk_size = df.extra_params.raw_chunk_size or options.tensor.chunk_size
chunk_size = decide_dataframe_chunk_sizes(df.shape, chunk_size, memory_usage)
chunk_size_idxes = (range(len(... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
df = op.outputs[0]
tensor = op.inputs[0]
nsplit_acc = np.cumsum(tensor.nsplits[0])
out_chunks = []
for chunk in tensor.chunks:
begin_index = nsplit_acc[chunk.index[0]] - chunk.shape[0]
end_index = nsplit_acc[chunk.index[0]]
chunk_index_value = parse_index(... | def tile(cls, op):
df = op.outputs[0]
tensor = op.inputs[0]
nsplit_acc = np.cumsum(tensor.nsplits[0])
out_chunks = []
for chunk in tensor.chunks:
begin_index = nsplit_acc[chunk.index[0]] - chunk.shape[0]
end_index = nsplit_acc[chunk.index[0]]
chunk_index_value = parse_index(... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute(cls, ctx, op):
chunk = op.outputs[0]
ctx[chunk.key] = pd.DataFrame.from_records(
ctx[op.inputs[0].key],
index=chunk.index_value.to_pandas(),
columns=chunk.columns_value.to_pandas(),
exclude=op.exclude,
coerce_float=op.coerce_float,
nrows=op.nrows,
... | def execute(cls, ctx, op):
chunk = op.outputs[0]
ctx[chunk.key] = pd.DataFrame.from_records(
ctx[op.inputs[0].key],
index=chunk.index_value.to_pandas(),
columns=chunk.columns.to_pandas(),
exclude=op.exclude,
coerce_float=op.coerce_float,
nrows=op.nrows,
)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
out_df = op.outputs[0]
in_tensor = op.input
out_chunks = []
nsplits = in_tensor.nsplits
if any(any(np.isnan(ns)) for ns in nsplits):
raise NotImplementedError("NAN shape is not supported in DataFrame")
cum_size = [np.cumsum(s) for s in nsplits]
for in_chunk in in_... | def tile(cls, op):
out_df = op.outputs[0]
in_tensor = op.input
out_chunks = []
nsplits = in_tensor.nsplits
if any(any(np.isnan(ns)) for ns in nsplits):
raise NotImplementedError("NAN shape is not supported in DataFrame")
cum_size = [np.cumsum(s) for s in nsplits]
for in_chunk in in_... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute(cls, ctx, op):
chunk = op.outputs[0]
tensor_data = ctx[op.inputs[0].key]
ctx[chunk.key] = pd.DataFrame(
tensor_data,
index=chunk.index_value.to_pandas(),
columns=chunk.columns_value.to_pandas(),
)
| def execute(cls, ctx, op):
chunk = op.outputs[0]
tensor_data = ctx[op.inputs[0].key]
ctx[chunk.key] = pd.DataFrame(
tensor_data,
index=chunk.index_value.to_pandas(),
columns=chunk.columns.to_pandas(),
)
| https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
in_df = build_concated_rows_frame(op.inputs[0])
out_df = op.outputs[0]
# First, perform groupby and aggregation on each chunk.
agg_chunks = []
for chunk in in_df.chunks:
agg_op = op.copy().reset_key()
agg_op._stage = Stage.agg
agg_chunk = agg_op.new_chunk(... | def tile(cls, op):
in_df = build_concated_rows_frame(op.inputs[0])
out_df = op.outputs[0]
# First, perform groupby and aggregation on each chunk.
agg_chunks = []
for chunk in in_df.chunks:
agg_op = op.copy().reset_key()
agg_op._stage = Stage.agg
agg_chunk = agg_op.new_chunk(... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, df):
if self.col_names is not None:
# if col_names is a list, return a DataFrame, else return a Series
if isinstance(self._col_names, list):
dtypes = df.dtypes[self._col_names]
columns = parse_index(pd.Index(self._col_names), store_data=True)
re... | def __call__(self, df):
if self.col_names is not None:
# if col_names is a list, return a DataFrame, else return a Series
if isinstance(self._col_names, list):
dtypes = df.dtypes[self._col_names]
columns = parse_index(pd.Index(self._col_names), store_data=True)
re... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile_with_mask(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
if isinstance(op.mask, SERIES_TYPE):
mask = op.inputs[1]
nsplits, out_shape, df_chunks, mask_chunks = align_dataframe_series(
in_df, mask, axis="index"
)
out_chunk_inde... | def tile_with_mask(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
out_chunks = []
if isinstance(op.mask, SERIES_TYPE):
mask = op.inputs[1]
nsplits, out_shape, df_chunks, mask_chunks = align_dataframe_series(
in_df, mask, axis="index"
)
out_chunk_inde... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile_with_columns(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
col_names = op.col_names
if not isinstance(col_names, list):
column_index = calc_columns_index(col_names, in_df)
out_chunks = []
dtype = in_df.dtypes[col_names]
for i in range(in_df.chunk_shape[0]... | def tile_with_columns(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
col_names = op.col_names
if not isinstance(col_names, list):
column_index = calc_columns_index(col_names, in_df)
out_chunks = []
dtype = in_df.dtypes[col_names]
for i in range(in_df.chunk_shape[0]... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def dataframe_getitem(df, item):
columns = df.columns_value.to_pandas()
if isinstance(item, list):
for col_name in item:
if col_name not in columns:
raise KeyError("%s not in columns" % col_name)
op = DataFrameIndex(col_names=item, object_type=ObjectType.dataframe)
... | def dataframe_getitem(df, item):
columns = df.columns.to_pandas()
if isinstance(item, list):
for col_name in item:
if col_name not in columns:
raise KeyError("%s not in columns" % col_name)
op = DataFrameIndex(col_names=item, object_type=ObjectType.dataframe)
elif... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, df):
# Note [Fancy Index of Numpy and Pandas]
#
# The numpy and pandas.iloc have different semantic when processing fancy index:
#
# >>> np.ones((3,3))[[1,2],[1,2]]
# array([1., 1.])
#
# >>> pd.DataFrame(np.ones((3,3))).iloc[[1,2],[1,2]]
# 1 2
# 1 1.0 1... | def __call__(self, df):
# Note [Fancy Index of Numpy and Pandas]
#
# The numpy and pandas.iloc have different semantic when processing fancy index:
#
# >>> np.ones((3,3))[[1,2],[1,2]]
# array([1., 1.])
#
# >>> pd.DataFrame(np.ones((3,3))).iloc[[1,2],[1,2]]
# 1 2
# 1 1.0 1... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
in_df = op.inputs[0]
out_val = op.outputs[0]
# See Note [Fancy Index of Numpy and Pandas]
tensor0 = empty(in_df.shape[0], chunk_size=(in_df.nsplits[0],))[
op.indexes[0]
].tiles()
tensor1 = empty(in_df.shape[1], chunk_size=(in_df.nsplits[1],))[
op.indexes[1]
... | def tile(cls, op):
in_df = op.inputs[0]
out_val = op.outputs[0]
# See Note [Fancy Index of Numpy and Pandas]
tensor0 = empty(in_df.shape[0], chunk_size=(in_df.nsplits[0],))[
op.indexes[0]
].tiles()
tensor1 = empty(in_df.shape[1], chunk_size=(in_df.nsplits[1],))[
op.indexes[1]
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def __call__(self, df):
if isinstance(self.indexes[0], TENSOR_TYPE) or isinstance(
self.indexes[1], TENSOR_TYPE
):
raise NotImplementedError("The index value cannot be unexecuted mars tensor")
return self.new_dataframe(
[df],
shape=df.shape,
dtypes=df.dtypes,
... | def __call__(self, df):
if isinstance(self.indexes[0], TENSOR_TYPE) or isinstance(
self.indexes[1], TENSOR_TYPE
):
raise NotImplementedError("The index value cannot be unexecuted mars tensor")
return self.new_dataframe(
[df],
shape=df.shape,
dtypes=df.dtypes,
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
# See Note [Fancy Index of Numpy and Pandas]
tensor0 = empty(in_df.shape[0], chunk_size=(in_df.nsplits[0],))[
op.indexes[0]
].tiles()
tensor1 = empty(in_df.shape[1], chunk_size=(in_df.nsplits[1],))[
op.indexes[1]
... | def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
# See Note [Fancy Index of Numpy and Pandas]
tensor0 = empty(in_df.shape[0], chunk_size=(in_df.nsplits[0],))[
op.indexes[0]
].tiles()
tensor1 = empty(in_df.shape[1], chunk_size=(in_df.nsplits[1],))[
op.indexes[1]
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
if not isinstance(op.keys, six.string_types):
raise NotImplementedError("DataFrame.set_index only support label")
if op.verify_integrity:
raise NotImplementedError(
"DataFrame.set_index not support verify_integri... | def tile(cls, op):
in_df = op.inputs[0]
out_df = op.outputs[0]
if not isinstance(op.keys, six.string_types):
raise NotImplementedError("DataFrame.set_index only support label")
if op.verify_integrity:
raise NotImplementedError(
"DataFrame.set_index not support verify_integri... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def calc_columns_index(column_name, df):
"""
Calculate the chunk index on the axis 1 according to the selected column.
:param column_name: selected column name
:param df: input tiled DataFrame
:return: chunk index on the columns axis
"""
column_nsplits = df.nsplits[1]
column_loc = df.col... | def calc_columns_index(column_name, df):
"""
Calculate the chunk index on the axis 1 according to the selected column.
:param column_name: selected column name
:param df: input tiled DataFrame
:return: chunk index on the columns axis
"""
column_nsplits = df.nsplits[1]
column_loc = df.col... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute(cls, ctx, op):
def _base_concat(chunk, inputs):
# auto generated concat when executing a DataFrame, Series or Index
if chunk.op.object_type == ObjectType.dataframe:
return _auto_concat_dataframe_chunks(chunk, inputs)
elif chunk.op.object_type == ObjectType.series:
... | def execute(cls, ctx, op):
def _base_concat(chunk, inputs):
# auto generated concat when executing a DataFrame, Series or Index
if chunk.op.object_type == ObjectType.dataframe:
return _auto_concat_dataframe_chunks(chunk, inputs)
elif chunk.op.object_type == ObjectType.series:
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _auto_concat_dataframe_chunks(chunk, inputs):
if chunk.op.axis is not None:
return pd.concat(inputs, axis=op.axis)
# auto generated concat when executing a DataFrame
n_rows = max(inp.index[0] for inp in chunk.inputs) + 1
n_cols = int(len(inputs) // n_rows)
assert n_rows * n_cols == len(i... | def _auto_concat_dataframe_chunks(chunk, inputs):
if chunk.op.axis is not None:
return pd.concat(inputs, axis=op.axis)
# auto generated concat when executing a DataFrame
n_rows = max(inp.index[0] for inp in chunk.inputs) + 1
n_cols = int(len(inputs) // n_rows)
assert n_rows * n_cols == len(i... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _gen_shuffle_chunks(cls, op, out_shape, shuffle_on, df):
# gen map chunks
map_chunks = []
for chunk in df.chunks:
map_op = DataFrameMergeAlignMap(
shuffle_on=shuffle_on,
sparse=chunk.issparse(),
index_shuffle_size=out_shape[0],
)
map_chunks.app... | def _gen_shuffle_chunks(cls, op, out_shape, shuffle_on, df):
# gen map chunks
map_chunks = []
for chunk in df.chunks:
map_op = DataFrameMergeAlignMap(
shuffle_on=shuffle_on,
sparse=chunk.issparse(),
index_shuffle_size=out_shape[0],
)
map_chunks.app... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
df = op.outputs[0]
left = build_concated_rows_frame(op.inputs[0])
right = build_concated_rows_frame(op.inputs[1])
# left and right now are guaranteed only chunked along index axis, not column axis.
assert left.chunk_shape[1] == 1
assert right.chunk_shape[1] == 1
left_row... | def tile(cls, op):
df = op.outputs[0]
left = build_concated_rows_frame(op.inputs[0])
right = build_concated_rows_frame(op.inputs[1])
# left and right now are guaranteed only chunked along index axis, not column axis.
assert left.chunk_shape[1] == 1
assert right.chunk_shape[1] == 1
left_row... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def concat_tileable_chunks(cls, tileable):
from .merge.concat import DataFrameConcat, GroupByConcat
from .operands import ObjectType, DATAFRAME_TYPE, SERIES_TYPE, GROUPBY_TYPE
df = tileable
assert not df.is_coarse()
if isinstance(df, DATAFRAME_TYPE):
chunk = DataFrameConcat(object_type=Obj... | def concat_tileable_chunks(cls, tileable):
from .merge.concat import DataFrameConcat, GroupByConcat
from .operands import ObjectType, DATAFRAME_TYPE, SERIES_TYPE, GROUPBY_TYPE
df = tileable
assert not df.is_coarse()
if isinstance(df, DATAFRAME_TYPE):
chunk = DataFrameConcat(object_type=Obj... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def split_monotonic_index_min_max(
left_min_max, left_increase, right_min_max, right_increase
):
"""
Split the original two min_max into new min_max. Each min_max should be a list
in which each item should be a 4-tuple indicates that this chunk's min value,
whether the min value is close, the max va... | def split_monotonic_index_min_max(
left_min_max, left_increase, right_min_max, right_increase
):
"""
Split the original two min_max into new min_max. Each min_max should be a list
in which each item should be a 4-tuple indicates that this chunk's min value,
whether the min value is close, the max va... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def build_split_idx_to_origin_idx(splits, increase=True):
# splits' len is equal to the original chunk size on a specified axis,
# splits is sth like [[(0, True, 2, True), (2, False, 3, True)]]
# which means there is one input chunk, and will be split into 2 out chunks
# in this function, we want to bui... | def build_split_idx_to_origin_idx(splits, increase=True):
# splits' len is equal to the original chunk size on a specified axis,
# splits is sth like [[(0, True, 2, True), (2, False, 3, True)]]
# which means there is one input chunk, and will be split into 2 out chunks
# in this function, we want to bui... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def build_concated_rows_frame(df):
from .operands import ObjectType
from .merge.concat import DataFrameConcat
# When the df isn't splitted along the column axis, return the df directly.
if df.chunk_shape[1] == 1:
return df
columns = concat_index_value(
[df.cix[0, idx].columns_value... | def build_concated_rows_frame(df):
from .operands import ObjectType
from .merge.concat import DataFrameConcat
# When the df isn't splitted along the column axis, return the df directly.
if df.chunk_shape[1] == 1:
return df
columns = concat_index_value(
[df.cix[0, idx].columns for i... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute_graph(
self,
graph,
keys,
n_parallel=None,
print_progress=False,
mock=False,
no_intermediate=False,
compose=True,
retval=True,
chunk_result=None,
):
"""
:param graph: graph to execute
:param keys: result keys
:param n_parallel: num of max parallelism
... | def execute_graph(
self,
graph,
keys,
n_parallel=None,
print_progress=False,
mock=False,
no_intermediate=False,
compose=True,
retval=True,
chunk_result=None,
):
"""
:param graph: graph to execute
:param keys: result keys
:param n_parallel: num of max parallelism
... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute_tileable(
self,
tileable,
n_parallel=None,
n_thread=None,
concat=False,
print_progress=False,
mock=False,
compose=True,
):
if concat:
# only for tests
tileable.tiles()
if len(tileable.chunks) > 1:
tileable = tileable.op.concat_tileable_... | def execute_tileable(
self,
tileable,
n_parallel=None,
n_thread=None,
concat=False,
print_progress=False,
mock=False,
compose=True,
):
if concat:
# only for tests
tileable.tiles()
if len(tileable.chunks) > 1:
tileable = tileable.op.concat_tileable_... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def _get_kw(obj):
if isinstance(obj, TENSOR_TYPE + TENSOR_CHUNK_TYPE):
return {"shape": obj.shape, "dtype": obj.dtype, "order": obj.order}
else:
return {
"shape": obj.shape,
"dtypes": obj.dtypes,
"index_value": obj.index_value,
"columns_value": obj... | def _get_kw(obj):
if isinstance(obj, TENSOR_TYPE + TENSOR_CHUNK_TYPE):
return {"shape": obj.shape, "dtype": obj.dtype, "order": obj.order}
else:
return {
"shape": obj.shape,
"dtypes": obj.dtypes,
"index_value": obj.index_value,
"columns_value": obj... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def tile(cls, op):
out = op.outputs[0]
out_chunks = []
data = op.data
if data.chunk_shape[1] > 1:
data = data.rechunk({1: op.data.shape[1]}).single_tiles()
for in_chunk in data.chunks:
chunk_op = op.copy().reset_key()
chunk_index = (in_chunk.index[0],)
if op.model.att... | def tile(cls, op):
out = op.outputs[0]
out_chunks = []
data = op.data
if data.chunk_shape[1] > 1:
data = data.rechunk({1: op.data.shape[1]}).single_tiles()
for in_chunk in data.chunks:
chunk_op = op.copy().reset_key()
chunk_index = (in_chunk.index[0],)
if op.model.att... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def sort_dataframe_result(df, result):
"""sort DataFrame on client according to `should_be_monotonic` attribute"""
if hasattr(df, "index_value"):
if getattr(df.index_value, "should_be_monotonic", False):
result.sort_index(inplace=True)
if hasattr(df, "columns_value"):
if ... | def sort_dataframe_result(df, result):
"""sort DataFrame on client according to `should_be_monotonic` attribute"""
if hasattr(df, "index_value"):
if getattr(df.index_value, "should_be_monotonic", False):
result.sort_index(inplace=True)
if hasattr(df, "columns"):
if getatt... | https://github.com/mars-project/mars/issues/814 | In [28]: df = md.DataFrame(np.random.rand(10, 2))
In [29]: df + np.random.rand(10, 2)
---------------------------------------------------------------------------
Exception Traceback (most recent call last)
<ipython-input-29-4a212df011a8> in <module>
----> 1 df + np.random.rand(10, 2)
~... | Exception |
def execute(cls, ctx, op):
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
kw = {"casting": op.casting} if op.out else {}
inputs_iter = iter(inputs)
lhs = op.lhs if np.isscalar(op.lhs) else ... | def execute(cls, ctx, op):
func_name = getattr(cls, "_func_name")
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
func = getattr(xp, func_name)
with device(device_id):
kw = {"casting": op.casting} if op.out else {}
... | https://github.com/mars-project/mars/issues/728 | In [13]: x = mt.random.rand(10, 10, gpu=True)
In [14]: (x + 1).execute()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-14-60cf72259190> in <module>
----> 1 (x + 1).execute()
~/mars/mars/tensor/core... | TypeError |
def execute(cls, ctx, op):
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
kw = {"casting": op.casting} if op.out else {}
if op.out and op.where:
inputs, kw["out"], kw["where"] = inputs[... | def execute(cls, ctx, op):
inputs, device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
func = cls._get_func(xp)
with device(device_id):
kw = {"casting": op.casting} if op.out else {}
if op.out and op.where:
inputs, kw[... | https://github.com/mars-project/mars/issues/728 | In [13]: x = mt.random.rand(10, 10, gpu=True)
In [14]: (x + 1).execute()
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-14-60cf72259190> in <module>
----> 1 (x + 1).execute()
~/mars/mars/tensor/core... | TypeError |
def has_value(self):
if isinstance(self._index_value, self.RangeIndex):
return True
elif getattr(self._index_value, "_data", None) is not None:
return True
return False
| def has_value(self):
if isinstance(self._index_value, self.RangeIndex):
return True
elif getattr(self, "_data", None) is not None:
return True
return False
| https://github.com/mars-project/mars/issues/718 | In [1]: import mars.dataframe as md
In [2]: import mars.tensor as mt
In [3]: df = md.DataFrame(mt.random.rand(10, 3), columns=list('abc'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-8015891094... | TypeError |
def __call__(self, input_tensor, index, columns):
if input_tensor.ndim != 1 and input_tensor.ndim != 2:
raise ValueError("Must pass 1-d or 2-d input")
if index is not None:
if input_tensor.shape[0] != len(index):
raise ValueError(
"index {0} should have the same shap... | def __call__(self, input_tensor, index, columns):
if index is not None or columns is not None:
if input_tensor.shape != (len(index), len(columns)):
raise ValueError(
"({0},{1}) should have the same shape with tensor: {2}".format(
index, columns, input_tensor.s... | https://github.com/mars-project/mars/issues/718 | In [1]: import mars.dataframe as md
In [2]: import mars.tensor as mt
In [3]: df = md.DataFrame(mt.random.rand(10, 3), columns=list('abc'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-8015891094... | TypeError |
def tile(cls, op):
out_df = op.outputs[0]
in_tensor = op.input
out_chunks = []
nsplits = in_tensor.nsplits
if any(any(np.isnan(ns)) for ns in nsplits):
raise NotImplementedError("NAN shape is not supported in DataFrame")
cum_size = [np.cumsum(s) for s in nsplits]
for in_chunk in in_... | def tile(cls, op):
out_df = op.outputs[0]
in_tensor = op.input
out_chunks = []
nsplits = in_tensor.nsplits
if any(any(np.isnan(ns)) for ns in nsplits):
raise NotImplementedError("NAN shape is not supported in DataFrame")
cum_size = [np.cumsum(s) for s in nsplits]
for in_chunk in in_... | https://github.com/mars-project/mars/issues/718 | In [1]: import mars.dataframe as md
In [2]: import mars.tensor as mt
In [3]: df = md.DataFrame(mt.random.rand(10, 3), columns=list('abc'))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-8015891094... | TypeError |
def execute_tileables(
self,
tileables,
fetch=True,
n_parallel=None,
n_thread=None,
print_progress=False,
mock=False,
compose=True,
):
graph = DirectedGraph()
result_keys = []
to_release_keys = []
concat_keys = []
for tileable in tileables:
tileable.tiles()
... | def execute_tileables(
self,
tileables,
fetch=True,
n_parallel=None,
n_thread=None,
print_progress=False,
mock=False,
compose=True,
):
graph = DirectedGraph()
result_keys = []
to_release_keys = []
concat_keys = []
for tileable in tileables:
tileable.tiles()
... | https://github.com/mars-project/mars/issues/642 | In [1]: import mars.tensor as mt
In [2]: a = mt.random.rand(4, 4) + 1 - 3
In [3]: u, s, v = mt.linalg.svd(a)
In [4]: (u + 1).execute()
Out[4]:
array([[0.53491564, 0.50844154, 1.31934217, 0.33660917],
[0.48043745, 0.58359388, 1.12894514, 1.73486995],
[0.54248881, 1.05235106, 0.12344775, 0.86000348],
[0.4482439 , 1.76... | InvalidComposedNodeError |
def execute(cls, ctx, op):
(a, b), device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
if not op.sparse and is_sparse_module(xp):
# tell sparse to do calculation on numpy or cupy matmul
ctx[op.ou... | def execute(cls, ctx, op):
(a, b), device_id, xp = as_same_device(
[ctx[c.key] for c in op.inputs], device=op.device, ret_extra=True
)
with device(device_id):
if not op.sparse and is_sparse_module(xp):
# tell sparse to do calculation on numpy or cupy matmul
ctx[op.ou... | https://github.com/mars-project/mars/issues/642 | In [1]: import mars.tensor as mt
In [2]: a = mt.random.rand(4, 4) + 1 - 3
In [3]: u, s, v = mt.linalg.svd(a)
In [4]: (u + 1).execute()
Out[4]:
array([[0.53491564, 0.50844154, 1.31934217, 0.33660917],
[0.48043745, 0.58359388, 1.12894514, 1.73486995],
[0.54248881, 1.05235106, 0.12344775, 0.86000348],
[0.4482439 , 1.76... | InvalidComposedNodeError |
def unify_nsplits(*tensor_axes):
from .rechunk import rechunk
tensor_splits = [
dict((a, split) for a, split in izip(axes, t.nsplits) if split != (1,))
for t, axes in tensor_axes
if t.nsplits
]
common_axes = (
reduce(operator.and_, [set(lkeys(ts)) for ts in tensor_splits... | def unify_nsplits(*tensor_axes):
from .rechunk import rechunk
tensor_splits = [
dict((a, split) for a, split in izip(axes, t.nsplits) if split != (1,))
for t, axes in tensor_axes
]
common_axes = reduce(operator.and_, [set(lkeys(ts)) for ts in tensor_splits])
axes_unified_splits = di... | https://github.com/mars-project/mars/issues/535 | In [5]: import mars.tensor as mt
In [6]: a = mt.random.rand(1, 10, chunk_size=3)
In [7]: b = mt.add(a[:, :5], 1, out=a[:, 5:])
In [8]: b.execute()
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~/Documents/mars_d... | KeyError |
def submit_graph(
self, session_id, serialized_graph, graph_key, target, compose=True, wait=True
):
session_uid = SessionActor.gen_uid(session_id)
session_ref = self.get_actor_ref(session_uid)
session_ref.submit_tileable_graph(
serialized_graph, graph_key, target, compose=compose, _tell=not wait... | def submit_graph(self, session_id, serialized_graph, graph_key, target, compose=True):
session_uid = SessionActor.gen_uid(session_id)
session_ref = self.get_actor_ref(session_uid)
session_ref.submit_tileable_graph(
serialized_graph, graph_key, target, compose=compose, _tell=True
)
| https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
def get_graph_state(self, session_id, graph_key):
from .scheduler import GraphState
graph_meta_ref = self.get_graph_meta_ref(session_id, graph_key)
if self.actor_client.has_actor(graph_meta_ref):
state_obj = graph_meta_ref.get_state()
state = state_obj.value if state_obj else "preparing"
... | def get_graph_state(self, session_id, graph_key):
from .scheduler import GraphState
graph_meta_ref = self.get_graph_meta_ref(session_id, graph_key)
if self.actor_client.has_actor(graph_meta_ref):
state_obj = graph_meta_ref.get_state()
state = state_obj.value if state_obj else "preparing"
... | https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
def calc_operand_assignments(self, op_keys, input_chunk_metas=None):
"""
Decide target worker for given chunks.
:param op_keys: keys of operands to assign
:param input_chunk_metas: chunk metas for graph-level inputs, grouped by initial chunks
:type input_chunk_metas: dict[str, dict[str, mars.schedu... | def calc_operand_assignments(self, op_keys, input_chunk_metas=None):
"""
Decide target worker for given chunks.
:param op_keys: keys of operands to assign
:param input_chunk_metas: chunk metas for graph-level inputs, grouped by initial chunks
:type input_chunk_metas: dict[str, dict[str, mars.schedu... | https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
def assign_operand_workers(self, op_keys, input_chunk_metas=None, analyzer=None):
operand_infos = self._operand_infos
chunk_graph = self.get_chunk_graph()
if analyzer is None:
analyzer = GraphAnalyzer(chunk_graph, self._get_worker_slots())
assignments = analyzer.calc_operand_assignments(
... | def assign_operand_workers(self, op_keys, input_chunk_metas=None, analyzer=None):
operand_infos = self._operand_infos
chunk_graph = self.get_chunk_graph()
if analyzer is None:
analyzer = GraphAnalyzer(chunk_graph, self._get_worker_slots())
assignments = analyzer.calc_operand_assignments(
... | https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
def handle_worker_change(self, adds, removes, lost_chunks, handle_later=True):
"""
Calculate and propose changes of operand states given changes
in workers and lost chunks.
:param adds: endpoints of workers newly added to the cluster
:param removes: endpoints of workers removed to the cluster
:... | def handle_worker_change(self, adds, removes, lost_chunks, handle_later=True):
"""
Calculate and propose changes of operand states given changes
in workers and lost chunks.
:param adds: endpoints of workers newly added to the cluster
:param removes: endpoints of workers removed to the cluster
:... | https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
def get(self, session_id, graph_key):
from ..scheduler.utils import GraphState
try:
state = self.web_api.get_graph_state(session_id, graph_key)
except GraphNotExists:
raise web.HTTPError(404, "Graph not exists")
if state == GraphState.RUNNING:
self.write(json.dumps(dict(state="... | def get(self, session_id, graph_key):
from ..scheduler.utils import GraphState
state = self.web_api.get_graph_state(session_id, graph_key)
if state == GraphState.RUNNING:
self.write(json.dumps(dict(state="running")))
elif state == GraphState.SUCCEEDED:
self.write(json.dumps(dict(state="... | https://github.com/mars-project/mars/issues/496 | 500 GET /worker?endpoint
Traceback (most recent call last):
File "/opt/conda/lib/python3.6/site-packages/tornado/web.py", line 1592, in _execute
result = yield result
File "/opt/conda/lib/python3.6/site-packages/tornado/gen.py", line 1133, in run
value = future.result()
File "/opt/conda/lib/python3.6/site-packages/torn... | ValueError |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.