Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def boxplot(
self,
column=None,
by=None,
ax=None,
fontsize=None,
rot=0,
grid=True,
figsize=None,
layout=None,
return_type=None,
**kwds
):
return to_pandas(self).boxplot(
column=column,
by=by,
ax=ax,
fontsize=fontsize,
rot=rot,
grid=grid,
figsize=figsize,
layout=layout,
return_type=return_type,
**kwds
)
right_by=None,
suffixes=("_x", "_y"),
tolerance=None,
allow_exact_matches=True,
direction="backward",
):
if not isinstance(left, DataFrame):
raise ValueError(
"can not merge DataFrame with instance of type {}".format(type(right))
)
ErrorMessage.default_to_pandas("`merge_asof`")
if isinstance(right, DataFrame):
right = to_pandas(right)
return DataFrame(
pandas.merge_asof(
to_pandas(left),
right,
on=on,
left_on=left_on,
right_on=right_on,
left_index=left_index,
right_index=right_index,
by=by,
left_by=left_by,
right_by=right_by,
suffixes=suffixes,
tolerance=tolerance,
allow_exact_matches=allow_exact_matches,
direction=direction,
)
Modin DataFrame to pandas DataFrame, etc. Currently, pytables
does not accept Modin DataFrame objects, so we must convert to
pandas.
Returns:
A Modin DataFrame in place of a pandas DataFrame, or the same
return type as pandas.HDFStore.
"""
from .utils import to_pandas
# We don't want to constantly be giving this error message for
# internal methods.
if item[0] != "_":
ErrorMessage.default_to_pandas("`{}`".format(item))
args = [
to_pandas(arg) if isinstance(arg, DataFrame) else arg
for arg in args
]
kwargs = {
k: to_pandas(v) if isinstance(v, DataFrame) else v
for k, v in kwargs.items()
}
obj = super(HDFStore, self).__getattribute__(item)(*args, **kwargs)
if isinstance(obj, pandas.DataFrame):
return DataFrame(obj)
return obj
def lreshape(data, groups, dropna=True, label=None):
if not isinstance(data, DataFrame):
raise ValueError("can not lreshape with instance of type {}".format(type(data)))
ErrorMessage.default_to_pandas("`lreshape`")
return DataFrame(
pandas.lreshape(to_pandas(data), groups, dropna=dropna, label=label)
)
left_by=None,
right_by=None,
fill_method=None,
suffixes=("_x", "_y"),
how="outer",
):
if not isinstance(left, DataFrame):
raise ValueError(
"can not merge DataFrame with instance of type {}".format(type(right))
)
ErrorMessage.default_to_pandas("`merge_ordered`")
if isinstance(right, DataFrame):
right = to_pandas(right)
return DataFrame(
pandas.merge_ordered(
to_pandas(left),
right,
on=on,
left_on=left_on,
right_on=right_on,
left_by=left_by,
right_by=right_by,
fill_method=fill_method,
suffixes=suffixes,
how=how,
)
on=None,
left_on=None,
right_on=None,
left_by=None,
right_by=None,
fill_method=None,
suffixes=("_x", "_y"),
how="outer",
):
if not isinstance(left, DataFrame):
raise ValueError(
"can not merge DataFrame with instance of type {}".format(type(right))
)
ErrorMessage.default_to_pandas("`merge_ordered`")
if isinstance(right, DataFrame):
right = to_pandas(right)
return DataFrame(
pandas.merge_ordered(
to_pandas(left),
right,
on=on,
left_on=left_on,
right_on=right_on,
left_by=left_by,
right_by=right_by,
fill_method=fill_method,
suffixes=suffixes,
how=how,
)
def where(
self,
cond,
other=np.nan,
inplace=False,
axis=None,
level=None,
errors="raise",
try_cast=False,
):
if isinstance(other, Series):
other = to_pandas(other)
return self._default_to_pandas(
pandas.Series.where,
cond,
other=other,
inplace=inplace,
axis=axis,
level=level,
errors=errors,
try_cast=try_cast,
)
Returns:
A Modin DataFrame in place of a pandas DataFrame, or the same
return type as pandas.HDFStore.
"""
from .utils import to_pandas
# We don't want to constantly be giving this error message for
# internal methods.
if item[0] != "_":
ErrorMessage.default_to_pandas("`{}`".format(item))
args = [
to_pandas(arg) if isinstance(arg, DataFrame) else arg
for arg in args
]
kwargs = {
k: to_pandas(v) if isinstance(v, DataFrame) else v
for k, v in kwargs.items()
}
obj = super(HDFStore, self).__getattribute__(item)(*args, **kwargs)
if isinstance(obj, pandas.DataFrame):
return DataFrame(obj)
return obj
def wide_to_long(df, stubnames, i, j, sep="", suffix=r"\d+"):
if not isinstance(df, DataFrame):
raise ValueError(
"can not wide_to_long with instance of type {}".format(type(df))
)
ErrorMessage.default_to_pandas("`wide_to_long`")
return DataFrame(
pandas.wide_to_long(to_pandas(df), stubnames, i, j, sep=sep, suffix=suffix)
)
right_index=False,
by=None,
left_by=None,
right_by=None,
suffixes=("_x", "_y"),
tolerance=None,
allow_exact_matches=True,
direction="backward",
):
if not isinstance(left, DataFrame):
raise ValueError(
"can not merge DataFrame with instance of type {}".format(type(right))
)
ErrorMessage.default_to_pandas("`merge_asof`")
if isinstance(right, DataFrame):
right = to_pandas(right)
return DataFrame(
pandas.merge_asof(
to_pandas(left),
right,
on=on,
left_on=left_on,
right_on=right_on,
left_index=left_index,
right_index=right_index,
by=by,
left_by=left_by,
right_by=right_by,
suffixes=suffixes,
tolerance=tolerance,
allow_exact_matches=allow_exact_matches,
direction=direction,