astro.files.types.ndjson

Module Contents

Classes

NDJSONFileType

Concrete implementation to handle NDJSON file type

class astro.files.types.ndjson.NDJSONFileType(path, normalize_config=None)

Bases: astro.files.types.base.FileType

Concrete implementation to handle NDJSON file type

Parameters
  • path (str) –

  • normalize_config (Optional[dict]) –

export_to_dataframe(stream, **kwargs)

read ndjson file from one of the supported locations and return dataframe

Parameters

stream – file stream object

create_from_dataframe(df, stream)

Write ndjson file to one of the supported locations

Parameters
  • df (pandas.DataFrame) – pandas dataframe

  • stream (io.TextIOWrapper) – file stream object

Return type

None

property name

get file type

static flatten(normalize_config, stream)

Flatten the nested ndjson/json.

Parameters
Returns

return dataframe containing the loaded data

Return type

pandas.DataFrame