Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def test_classify_type():
assert utils.classify_type('string') == 'S'
assert utils.classify_type('boolean') == 'B'
assert utils.classify_type('float64') == 'F'
assert utils.classify_type('integer64') == 'I'
assert utils.classify_type('timestamp') == 'D'
assert utils.classify_type('timedelta') == 'TD'
assert utils.classify_type('foo') == 'S'
def _format_dtype(col_index, col):
dtype = dtypes[col]
dtype_data = dict(name=col, dtype=dtype, index=col_index)
if classify_type(dtype) == 'F' and not data[col].isnull().all(): # floats
dtype_data['min'] = mins[col]
dtype_data['max'] = maxs[col]
return dtype_data
:param data_id: integer string identifier for a D-Tale process's data
:type data_id: str
:param column: required dash separated string "START-END" stating a range of row indexes to be returned
to the screen
:return: JSON {
describe: object representing output from :meth:`pandas:pandas.Series.describe`,
unique_data: array of unique values when data has <= 100 unique values
success: True/False
}
"""
try:
data = DATA[data_id]
additional_aggs = None
dtype = next((dtype_info['dtype'] for dtype_info in DTYPES[data_id] if dtype_info['name'] == column), None)
if classify_type(dtype) in ['I', 'F']:
additional_aggs = ['sum', 'median', 'mode', 'var', 'sem', 'skew', 'kurt']
desc = load_describe(data[column], additional_aggs=additional_aggs)
return_data = dict(describe=desc, success=True)
uniq_vals = data[column].unique()
if 'unique' not in return_data['describe']:
return_data['describe']['unique'] = json_int(len(uniq_vals), as_string=True)
if len(uniq_vals) <= 100:
uniq_f = find_dtype_formatter(get_dtypes(data)[column])
return_data['uniques'] = dict(
data=[uniq_f(u, nan_display='N/A') for u in uniq_vals],
top=False
)
else: # get top 100 most common values
uniq_vals = data[column].value_counts().sort_values(ascending=False).head(100).index.values
uniq_f = find_dtype_formatter(get_dtypes(data)[column])
return_data['uniques'] = dict(