typeddfs._mixins._lines_mixin

Mixin for line-by-line text files.

Module Contents

class typeddfs._mixins._lines_mixin._LinesMixin
classmethod _lines_files_apply(cls) bool
_tabulate(self, fmt: Union[str, tabulate.TableFormat], **kwargs) str
classmethod read_lines(cls, path_or_buff, **kwargs) __qualname__

Reads a file that contains 1 row and 1 column per line. Skips lines that are blank after trimming whitespace. Also skips comments if comment is set.

Caution

For technical reasons, values cannot contain a 6-em space (U+2008). Their presence will result in undefined behavior.

Parameters
  • path_or_buff – Path or buffer

  • kwargs – Passed to pd.DataFrame.read_csv E.g. ‘comment’, ‘encoding’, ‘skip_blank_lines’, and ‘line_terminator’

to_lines(self, path_or_buff=None, mode: str = 'w', **kwargs) Optional[str]

Writes a file that contains one row per line and 1 column per line. Associated with .lines or .txt.

Caution

For technical reasons, values cannot contain a 6-em space (U+2008). Their presence will result in undefined behavior.

Parameters
  • path_or_buff – Path or buffer

  • mode – Write (‘w’) or append (‘a’)

  • kwargs – Passed to pd.DataFrame.to_csv

Returns

The string data if path_or_buff is a buffer; None if it is a file