Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
if isinstance(importoptions, (dict, ParamManager)) and \
'filetype' not in [x.lower() for x in importoptions.keys()]:
ext = os.path.splitext(filename)[-1][1:].lower()
if ext in filetype:
importoptions['filetype'] = filetype[ext]
elif len(ext) == 3 and ext.endswith('sv'):
importoptions['filetype'] = 'csv'
kwargs['importoptions'] = importoptions
if df_dtypes:
self._apply_importoptions_vars(importoptions, df_dtypes)
if casout is None:
casout = {}
if isinstance(casout, CASTable):
casout = casout.to_outtable_params()
if isinstance(casout, dict) and 'name' not in casout:
casout['name'] = name
kwargs['casout'] = casout
if isinstance(self._sw_connection, rest.REST_CASConnection):
resp = self._sw_connection.upload(a2n(filename), kwargs)
else:
resp = errorcheck(self._sw_connection.upload(a2n(filename),
py2cas(self._soptions,
self._sw_error,
**kwargs)),
self._sw_connection)
# Remove temporary file as needed
if delete:
added to the casout option.
Returns
-------
:class:`ImageTable`
'''
out = cls(**tbl.params)
conn = tbl.get_connection()
conn.loadactionset('image', _messagelevel='error')
if casout is None:
casout = {}
elif isinstance(casout, CASTable):
casout = casout.to_outtable_params()
if 'name' not in casout:
casout['name'] = random_name()
if '_filename_0' in tbl.columninfo().ColumnInfo.Column.tolist():
computedvars = []
code = []
else:
computedvars = ['_filename_0']
code = ['length _filename_0 varchar(*);']
if path_col is not None:
code.append(('_loc1 = LENGTH({0}) - '
'INDEX(REVERSE({0}),\'/\')+2;').format(path_col))
code.append('_filename_0 = SUBSTR({},_loc1);'.format(path_col))
else:
def __copy__(self):
out = CASTable.__copy__(self)
out.patch_level = self.patch_level
return out
def __init__(self, name, **table_params):
CASTable.__init__(self, name, **table_params)
self.patch_level = 0
it directly.
Parameters
----------
name : string
Name of the table in CAS.
**kwargs : any, optional
Arbitrary keyword arguments. These keyword arguments are
passed to the :class:`CASTable` constructor.
Returns
-------
:class:`CASTable` object
'''
table = CASTable(name, **kwargs)
table.set_connection(self)
return table
ax.legend(loc='best', bbox_to_anchor=(1, 1), prop={'size': fontsize_spec['legend']})
if 'xtick' in fontsize_spec.keys():
ax.get_xaxis().set_tick_params(direction='out', labelsize=fontsize_spec['xtick'])
else:
ax.get_xaxis().set_tick_params(direction='out')
if 'ytick' in fontsize_spec.keys():
ax.get_yaxis().set_tick_params(direction='out', labelsize=fontsize_spec['ytick'])
else:
ax.get_yaxis().set_tick_params(direction='out')
return (fig, ax)
class TimeseriesTable(CASTable):
'''
Table for preprocessing timeseries
It creates an instance of :class:`TimeseriesTable` by loading from
files on the server side, or files on the client side, or in
memory :class:`CASTable`, :class:`pandas.DataFrame` or
:class:`pandas.Series. It then performs inplace timeseries formatting,
timeseries accumulation, timeseries subsequence generation, and
timeseries partitioning to prepare the timeseries into a format that
can be followed by subsequent deep learning models.
Parameters
----------
name : string, optional
Name of the CAS table
timeid : string, optional
def _normalize_list(items):
''' Normalize objects using standard python types '''
newitems = []
for item in items:
if isinstance(item, dict_types):
item = _normalize_params(item)
elif isinstance(item, items_types):
item = _normalize_list(item)
elif isinstance(item, CASTable):
item = _normalize_params(item.to_params())
newitems.append(item)
return newitems
importoptions from CAS.upload.
Default: None
casout : dict or :class:`CASTable`, optional
If it is dict, it specifies the output CASTable parameters.
If it is CASTable, it is the CASTable that will be overwritten.
None means a new CASTable with random name will be generated.
Default: None
Returns
-------
:class:`TimeseriesTable`
'''
if casout is None:
casout_params = {}
elif isinstance(casout, CASTable):
casout_params = casout.to_outtable_params()
elif isinstance(casout, dict):
casout_params = casout
if 'name' not in casout_params:
casout_params['name'] = random_name('ts', 4)
if importoptions is None:
importoptions = {}
upload_result = conn.upload(path,
importoptions=importoptions,
casout=casout_params)
tbl = conn.CASTable(**casout_params)
Returns
-------
:class:`CASTable`
'''
output_name = random_name('AudioTable_Metadata', 6)
dc = DataClean(conn=conn, contents_as_path=path)
dc_response = dc.process_contents(audio_path = audio_path)
tbl = dc.create_castable(dc_response['results'], output_name, replace=True, promote=False,
col_names=dc_response['col_names'])
scode = 'length _fName_ $1000; '
scode += '_fName_ = _filename_; '
ctbl = CASTable(tbl, computedvars=['_fName_'],
computedvarsprogram=scode)
conn.table.partition(table=ctbl, casout=dict(name=tbl, replace=True))
return CASTable(tbl)