OpenSesame
Rapunzel Code Editor
DataMatrix
Support forum
Python Tutorials
MindProbe
PythonLiveLessons
Python videos

datamatrix.io

Reading and writing DataMatrix objects from and to file.

function readpickle(path)

Reads a DataMatrix from a pickle file.

Example:

dm = io.readpickle('data.pkl')

Arguments:

  • path -- The path to the pickle file.

Returns:

A DataMatrix.

function readtxt(path, delimiter=u',', quotechar=u'"', default_col_type=)

Reads a DataMatrix from a csv file.

Example:

dm = io.readtxt('data.csv')

Version note: As of 0.10.7, byte-order marks (BOMs) are silently stripped from column names.

Arguments:

  • path -- The path to the pickle file.

Keywords:

  • delimiter -- The delimiter characer.
    • Default: ','
  • quotechar -- The quote character.
    • Default: '"'
  • default_col_type -- The default column type.
    • Default:

Returns:

A DataMatrix.

function readxlsx(path, default_col_type=, sheet=None)

Reads a DataMatrix from an Excel 2010 xlsx file.

Example:

dm = io.readxlsx('data.xlsx')

Arguments:

  • path -- The path to the xlsx file.

Keywords:

  • default_col_type -- The default column type.
    • Default:
  • sheet -- The name of a sheet, or None to open the active sheet. The activate sheet is not necessarily the first sheet. (New in 0.7.0)
    • Default: None

Returns:

A DataMatrix.

function writepickle(dm, path, protocol=-1)

Writes a DataMatrix to a pickle file.

Example:

io.writepickle(dm, 'data.pkl')

Arguments:

  • dm -- The DataMatrix to write.
  • path -- The path to the pickle file.

Keywords:

  • protocol -- The pickle protocol.
    • Default: -1

function writetxt(dm, path, delimiter=u',', quotechar=u'"')

Writes a DataMatrix to a csv file.

Example:

io.writetxt(dm, 'data.csv')

Arguments:

  • dm -- The DataMatrix to write.
  • path -- The path to the pickle file.

Keywords:

  • delimiter -- The delimiter characer.
    • Default: ','
  • quotechar -- The quote character.
    • Default: '"'

function writexlsx(dm, path)

Writes a DataMatrix to an Excel 2010 xlsx file. The first sheet will contain a regular table with all non-series columns. SeriesColumns are saved as individual sheets.

Example:

io.writexlsx(dm, 'data.xlsx')

Arguments:

  • dm -- The DataMatrix to write.
  • path -- The path to the xlsx file.