load_from_tsfile#

load_from_tsfile(full_file_path_and_name, replace_missing_vals_with='NaN', return_y=True, return_data_type='nested_univ', encoding='utf-8')[source]#

Load time series .ts file into X and (optionally) y.

Data from a .ts file is loaded into a nested pd.DataFrame, or optionally into a 2d np.ndarray (equal length, univariate problem) or 3d np.ndarray (equal length, multivariate problem) if requested. If present, y is loaded into a 1d np.ndarray.

Parameters:
full_file_path_and_namestr

The full pathname and file name of the .ts file to read.

replace_missing_vals_withstr, default NaN

The value that missing values in the text file should be replaced with prior to parsing.

return_yboolean, default True

whether to return the y variable, if it is present.

return_data_typestr, optional, default = “nested_univ”

memory data format specification to return X in. str can be any other supported Panel mtype

for list of mtypes, see datatypes.SCITYPE_REGISTER for specifications, see examples/AA_datatypes_and_datasets.ipynb

commonly used specifications:

“nested_univ: nested pd.DataFrame, pd.Series in cells “numpy3D”/”numpy3d”/”np3D”: 3D np.ndarray (instance, variable, time index) “numpy2d”/”np2d”/”numpyflat”: 2D np.ndarray (instance, time index) “pd-multiindex”: pd.DataFrame with 2-level (instance, time) MultiIndex

Exception is raised if the data cannot be stored in the requested type.

encoding: str

encoding is the name of the encoding used to read file using the open function.

Returns:
Xsktime compatible in-memory container of mtype return_data_type

for list of mtypes, see datatypes.SCITYPE_REGISTER for specifications, see examples/AA_datatypes_and_datasets.ipynb

yreturned only if return_y=True, np.ndarray
Raises:
IOError if the requested file does not exist
IOError if input series are not all the same dimension (not supported)
IOError if class labels have been requested but are not present in the file
IOError if the input file has no cases
ValueError if return_data_type = numpy3d but the data are unequal length series
ValueError if return_data_type = numpy2d but the data are multivariate and/
or unequal length series