dlpy.timeseries.TimeseriesTable.from_pandas

classmethod TimeseriesTable.from_pandas(conn, pandas_df, casout=None)

Create an TimeseriesTable from a pandas DataFrame or Series

Parameters:
conn : CAS

The CAS connection object

pandas_df : pandas.DataFrame or pandas.Series

The pandas dataframe or series to use as the source.

casout : dict or 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:
TimeseriesTable

Examples

>>> from swat import CAS
>>> from dlpy.timeseries import TimeseriesTable
>>> from pandas import DataFrame
>>> s = CAS("cloud.example.com", 5570)
>>> df = DataFrame()
>>> df['id1var'] = [1, 2, 3, 4]
>>> df['date'] = ['2015-01-01','2015-01-02', '2015-01-03', '2015-01-04']
>>> df['series'] = [0.1234, 0.2345, 0.3456, 0.4567]
>>> time_tbl = TimeseriesTable.from_pandas(s, df, casout=dict(name="time_tbl", replace=True))