mvtsdatatoolkit.utils package

Submodules

mvtsdatatoolkit.utils.meta_data_getter module

mvtsdatatoolkit.utils.meta_data_getter.extract_tagged_info(file_name: str, tag: str)str[source]

Extracts the incorporated info of an MVTS from the given file name. This is a generic method that considers the substring after tag, wrapped in square brackets, as the piece of information that is of interest. The value of the string tag depends on how the mvts files are named. Any piece of information can be encoded in the filename using a substring following the pattern as t[x], where t is the tag, and x is the information of interest.

For example, for the following filename:

file_name: ‘lab[B]1.0@1053_id[345]_st[2011-01-24T03:24:00]_et[2011-01-24T11:12:00].csv’

tag : ‘lab’

The tag ‘lab’ can be used to extract the MVTS class ‘B’, or the tag et might be used to get access to the end time ‘2011-01-24T11:12:00’, and so on.

Parameters
  • file_name – MVTS filename with a class-label string encoded in it that follows the description above.

  • tag – A string that points to the piece of info of interest.

Returns

The embedded class label of the given filename.

mvtsdatatoolkit.utils.meta_data_getter.get_end_pair_index(s: str, i: int)[source]

This method takes a string and an integer as inputs. It searches for the opening brace’[‘ using the given integer as the index of the opening brace in the given string. It outputs the index of the closing pair ‘]’ in the string.

Parameters
  • s – The input string.

  • i – Index position of the opening brace ‘[‘

Returns

Index position of the closing pair ‘]’ of the opening brace ‘[‘

mvtsdatatoolkit.utils.meta_data_getter.get_substring(file_name: str, left_expression: str)str[source]

Extracts the substring after the id_tag(given) and in between first occurrence of [ ] from the filename (given). Filename format: lab[B]1.0@1053_id[345]_st[2011-01-24T03:24:00]_et[2011-01-24T11:12:00].csv Left_expression : id Extracted Substring : 345

Parameters
  • file_name – A string that contains the time-series filename with the specified format

  • left_expression – A string in the filename that points to the beginning of the embedded substring.

Returns

The embedded substring of the given file name.

mvtsdatatoolkit.utils.mvts_cleaner module

mvtsdatatoolkit.utils.mvts_cleaner.interpolate_missing_vals(df: pandas.core.frame.DataFrame) → pandas.core.frame.DataFrame[source]

Interpolates the missing values (i.e., NaN’s) using linear interpolation. That is, for any group of consecutive missing values, it treats the values as equally spaced numbers between the present values before and after the gap. This does not impact non-numerical values.

Returns

The interpolated version of the given dataframe.

Module contents