ktk.save#

save(filename, variable)[source]#

Save a variable to a ktk.zip file.

A ktk.zip file is a zipped folder containing two files:

  • metadata.json, which includes save date, user, etc.

  • data.json, which includes the data.

The following classes are supported:

  • dict containing any supported class

  • list containing any supported class

  • str

  • int

  • float

  • True

  • False

  • None

  • numpy.array

  • pandas.DataFrame (basic DataFrames, e.g., without multi-indexing.)

  • pandas.Series

  • ktk.TimeSeries

Parameters
  • filename (str) – Name of the file to save to (e.g., “file.ktk.zip”)

  • variable (Any) – The variable to save.

Return type

None

Caution

Tuples are also supported but will be loaded back as lists, without warning. Complex Pandas Series (e.g., series or different types) may not be supported: only name, index and data are saved. Complex Pandas DataFrames (e.g., multiindex, columns of different types) may not be supported: only columns, index, and data are saved.

See also

ktk.load