typeddfs._mixins._fwf_mixin

Mixin for fixed-width format.

Module Contents

class typeddfs._mixins._fwf_mixin._FwfMixin
classmethod read_fwf(cls, *args, **kwargs) __qualname__
to_fwf(self, path_or_buff=None, mode: str = 'w', colspecs: Optional[Sequence[Tuple[int, int]]] = None, widths: Optional[Sequence[int]] = None, na_rep: Optional[str] = None, float_format: Optional[str] = None, date_format: Optional[str] = None, decimal: str = '.', **kwargs) Optional[str]

Writes a fixed-width text format. See read_fwf and to_flexwf for more info.

Parameters
  • path_or_buff – Path or buffer

  • mode – write or append (w/a)

  • colspecs – A list of tuples giving the extents of the fixed-width fields of each line as half-open intervals (i.e., [from, to[ )

  • widths – A list of field widths which can be used instead of colspecs if the intervals are contiguous

  • na_rep – Missing data representation

  • float_format – Format string for floating point numbers

  • date_format – Format string for datetime objects

  • decimal – Character recognized as decimal separator. E.g. use β€˜,’ for European data.

  • kwargs – Passed to typeddfs.utils.Utils.write()

Returns

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