Skip to content

Commit

Permalink
Reformat missing dir
Browse files Browse the repository at this point in the history
  • Loading branch information
charlesdong1991 committed Sep 8, 2019
1 parent db3cf1e commit 6d78413
Show file tree
Hide file tree
Showing 6 changed files with 528 additions and 506 deletions.
22 changes: 12 additions & 10 deletions databricks/koalas/missing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,30 @@


def _unsupported_function(class_name, method_name, deprecated=False, reason=""):

def unsupported_function(*args, **kwargs):
raise PandasNotImplementedError(class_name=class_name, method_name=method_name,
reason=reason)
raise PandasNotImplementedError(
class_name=class_name, method_name=method_name, reason=reason
)

def deprecated_function(*args, **kwargs):
raise PandasNotImplementedError(class_name=class_name, method_name=method_name,
deprecated=deprecated, reason=reason)
raise PandasNotImplementedError(
class_name=class_name, method_name=method_name, deprecated=deprecated, reason=reason
)

return deprecated_function if deprecated else unsupported_function


def _unsupported_property(class_name, property_name, deprecated=False, reason=""):

@property
def unsupported_property(self):
raise PandasNotImplementedError(class_name=class_name, property_name=property_name,
reason=reason)
raise PandasNotImplementedError(
class_name=class_name, property_name=property_name, reason=reason
)

@property
def deprecated_property(self):
raise PandasNotImplementedError(class_name=class_name, property_name=property_name,
deprecated=deprecated, reason=reason)
raise PandasNotImplementedError(
class_name=class_name, property_name=property_name, deprecated=deprecated, reason=reason
)

return deprecated_property if deprecated else unsupported_property
34 changes: 19 additions & 15 deletions databricks/koalas/missing/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,36 @@


memory_usage = lambda f: f(
'memory_usage',
"memory_usage",
reason="Unlike pandas, most DataFrames are not materialized in memory in Spark "
"(and Koalas), and as a result memory_usage() does not do what you intend it "
"to do. Use Spark's web UI to monitor disk and memory usage of your application.")
"(and Koalas), and as a result memory_usage() does not do what you intend it "
"to do. Use Spark's web UI to monitor disk and memory usage of your application.",
)

values = lambda f: f(
'values',
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.")
"values", reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead."
)

array = lambda f: f(
'array',
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.")
"array", reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead."
)

to_pickle = lambda f: f(
'to_pickle',
"to_pickle",
reason="For storage, we encourage you to use Delta or Parquet, instead of Python pickle "
"format.")
"format.",
)

to_xarray = lambda f: f(
'to_xarray',
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.")
"to_xarray",
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.",
)

to_list = lambda f: f(
'to_list',
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.")
"to_list",
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.",
)

tolist = lambda f: f(
'tolist',
reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead.")
"tolist", reason="If you want to collect your data as an NumPy array, use 'to_numpy()' instead."
)
200 changes: 101 additions & 99 deletions databricks/koalas/missing/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,119 +18,121 @@


def unsupported_function(method_name, deprecated=False, reason=""):
return _unsupported_function(class_name='pd.DataFrame', method_name=method_name,
deprecated=deprecated, reason=reason)
return _unsupported_function(
class_name="pd.DataFrame", method_name=method_name, deprecated=deprecated, reason=reason
)


def unsupported_property(property_name, deprecated=False, reason=""):
return _unsupported_property(class_name='pd.DataFrame', property_name=property_name,
deprecated=deprecated, reason=reason)
return _unsupported_property(
class_name="pd.DataFrame", property_name=property_name, deprecated=deprecated, reason=reason
)


class _MissingPandasLikeDataFrame(object):

# Properties
axes = unsupported_property('axes')
iat = unsupported_property('iat')
ndim = unsupported_property('ndim')
axes = unsupported_property("axes")
iat = unsupported_property("iat")
ndim = unsupported_property("ndim")

# Deprecated properties
blocks = unsupported_property('blocks', deprecated=True)
ftypes = unsupported_property('ftypes', deprecated=True)
is_copy = unsupported_property('is_copy', deprecated=True)
ix = unsupported_property('ix', deprecated=True)
blocks = unsupported_property("blocks", deprecated=True)
ftypes = unsupported_property("ftypes", deprecated=True)
is_copy = unsupported_property("is_copy", deprecated=True)
ix = unsupported_property("ix", deprecated=True)

# Functions
agg = unsupported_function('agg')
aggregate = unsupported_function('aggregate')
align = unsupported_function('align')
apply = unsupported_function('apply')
asfreq = unsupported_function('asfreq')
asof = unsupported_function('asof')
at_time = unsupported_function('at_time')
between_time = unsupported_function('between_time')
boxplot = unsupported_function('boxplot')
combine = unsupported_function('combine')
combine_first = unsupported_function('combine_first')
corrwith = unsupported_function('corrwith')
cov = unsupported_function('cov')
dot = unsupported_function('dot')
droplevel = unsupported_function('droplevel')
eval = unsupported_function('eval')
ewm = unsupported_function('ewm')
expanding = unsupported_function('expanding')
first = unsupported_function('first')
first_valid_index = unsupported_function('first_valid_index')
hist = unsupported_function('hist')
idxmax = unsupported_function('idxmax')
idxmin = unsupported_function('idxmin')
infer_objects = unsupported_function('infer_objects')
info = unsupported_function('info')
insert = unsupported_function('insert')
interpolate = unsupported_function('interpolate')
items = unsupported_function('items')
iterrows = unsupported_function('iterrows')
itertuples = unsupported_function('itertuples')
keys = unsupported_function('keys')
last = unsupported_function('last')
last_valid_index = unsupported_function('last_valid_index')
lookup = unsupported_function('lookup')
mad = unsupported_function('mad')
mask = unsupported_function('mask')
mode = unsupported_function('mode')
pct_change = unsupported_function('pct_change')
pop = unsupported_function('pop')
prod = unsupported_function('prod')
product = unsupported_function('product')
quantile = unsupported_function('quantile')
query = unsupported_function('query')
reindex_like = unsupported_function('reindex_like')
rename = unsupported_function('rename')
rename_axis = unsupported_function('rename_axis')
reorder_levels = unsupported_function('reorder_levels')
resample = unsupported_function('resample')
rolling = unsupported_function('rolling')
sem = unsupported_function('sem')
set_axis = unsupported_function('set_axis')
slice_shift = unsupported_function('slice_shift')
squeeze = unsupported_function('squeeze')
stack = unsupported_function('stack')
swapaxes = unsupported_function('swapaxes')
swaplevel = unsupported_function('swaplevel')
tail = unsupported_function('tail')
take = unsupported_function('take')
to_feather = unsupported_function('to_feather')
to_gbq = unsupported_function('to_gbq')
to_hdf = unsupported_function('to_hdf')
to_period = unsupported_function('to_period')
to_sql = unsupported_function('to_sql')
to_stata = unsupported_function('to_stata')
to_timestamp = unsupported_function('to_timestamp')
truncate = unsupported_function('truncate')
tshift = unsupported_function('tshift')
tz_convert = unsupported_function('tz_convert')
tz_localize = unsupported_function('tz_localize')
unstack = unsupported_function('unstack')
where = unsupported_function('where')
xs = unsupported_function('xs')
agg = unsupported_function("agg")
aggregate = unsupported_function("aggregate")
align = unsupported_function("align")
apply = unsupported_function("apply")
asfreq = unsupported_function("asfreq")
asof = unsupported_function("asof")
at_time = unsupported_function("at_time")
between_time = unsupported_function("between_time")
boxplot = unsupported_function("boxplot")
combine = unsupported_function("combine")
combine_first = unsupported_function("combine_first")
corrwith = unsupported_function("corrwith")
cov = unsupported_function("cov")
dot = unsupported_function("dot")
droplevel = unsupported_function("droplevel")
eval = unsupported_function("eval")
ewm = unsupported_function("ewm")
expanding = unsupported_function("expanding")
first = unsupported_function("first")
first_valid_index = unsupported_function("first_valid_index")
hist = unsupported_function("hist")
idxmax = unsupported_function("idxmax")
idxmin = unsupported_function("idxmin")
infer_objects = unsupported_function("infer_objects")
info = unsupported_function("info")
insert = unsupported_function("insert")
interpolate = unsupported_function("interpolate")
items = unsupported_function("items")
iterrows = unsupported_function("iterrows")
itertuples = unsupported_function("itertuples")
keys = unsupported_function("keys")
last = unsupported_function("last")
last_valid_index = unsupported_function("last_valid_index")
lookup = unsupported_function("lookup")
mad = unsupported_function("mad")
mask = unsupported_function("mask")
mode = unsupported_function("mode")
pct_change = unsupported_function("pct_change")
pop = unsupported_function("pop")
prod = unsupported_function("prod")
product = unsupported_function("product")
quantile = unsupported_function("quantile")
query = unsupported_function("query")
reindex_like = unsupported_function("reindex_like")
rename = unsupported_function("rename")
rename_axis = unsupported_function("rename_axis")
reorder_levels = unsupported_function("reorder_levels")
resample = unsupported_function("resample")
rolling = unsupported_function("rolling")
sem = unsupported_function("sem")
set_axis = unsupported_function("set_axis")
slice_shift = unsupported_function("slice_shift")
squeeze = unsupported_function("squeeze")
stack = unsupported_function("stack")
swapaxes = unsupported_function("swapaxes")
swaplevel = unsupported_function("swaplevel")
tail = unsupported_function("tail")
take = unsupported_function("take")
to_feather = unsupported_function("to_feather")
to_gbq = unsupported_function("to_gbq")
to_hdf = unsupported_function("to_hdf")
to_period = unsupported_function("to_period")
to_sql = unsupported_function("to_sql")
to_stata = unsupported_function("to_stata")
to_timestamp = unsupported_function("to_timestamp")
truncate = unsupported_function("truncate")
tshift = unsupported_function("tshift")
tz_convert = unsupported_function("tz_convert")
tz_localize = unsupported_function("tz_localize")
unstack = unsupported_function("unstack")
where = unsupported_function("where")
xs = unsupported_function("xs")

# Deprecated functions
as_blocks = unsupported_function('as_blocks', deprecated=True)
as_matrix = unsupported_function('as_matrix', deprecated=True)
clip_lower = unsupported_function('clip_lower', deprecated=True)
clip_upper = unsupported_function('clip_upper', deprecated=True)
convert_objects = unsupported_function('convert_objects', deprecated=True)
get_ftype_counts = unsupported_function('get_ftype_counts', deprecated=True)
get_value = unsupported_function('get_value', deprecated=True)
select = unsupported_function('select', deprecated=True)
set_value = unsupported_function('set_value', deprecated=True)
to_panel = unsupported_function('to_panel', deprecated=True)
get_values = unsupported_function('get_values', deprecated=True)
to_dense = unsupported_function('to_dense', deprecated=True)
to_sparse = unsupported_function('to_sparse', deprecated=True)
to_msgpack = unsupported_function('to_msgpack', deprecated=True)
compound = unsupported_function('compound', deprecated=True)
reindex_axis = unsupported_function('reindex_axis', deprecated=True)
as_blocks = unsupported_function("as_blocks", deprecated=True)
as_matrix = unsupported_function("as_matrix", deprecated=True)
clip_lower = unsupported_function("clip_lower", deprecated=True)
clip_upper = unsupported_function("clip_upper", deprecated=True)
convert_objects = unsupported_function("convert_objects", deprecated=True)
get_ftype_counts = unsupported_function("get_ftype_counts", deprecated=True)
get_value = unsupported_function("get_value", deprecated=True)
select = unsupported_function("select", deprecated=True)
set_value = unsupported_function("set_value", deprecated=True)
to_panel = unsupported_function("to_panel", deprecated=True)
get_values = unsupported_function("get_values", deprecated=True)
to_dense = unsupported_function("to_dense", deprecated=True)
to_sparse = unsupported_function("to_sparse", deprecated=True)
to_msgpack = unsupported_function("to_msgpack", deprecated=True)
compound = unsupported_function("compound", deprecated=True)
reindex_axis = unsupported_function("reindex_axis", deprecated=True)

# Properties we won't support.
values = common.values(unsupported_property)
Expand Down
Loading

0 comments on commit 6d78413

Please sign in to comment.