Spec-Zone.ru › Polars

polars.DataFrame.write_avro

DataFrame.write_avro(
    file: str | Path | IO[bytes],
    compression: AvroCompression = 'uncompressed',
    name: str = '',
) → None

Write to Apache Avro file.

Parameters:
file

File path or writable file-like object to which the data will be written.

compression{‘uncompressed’, ‘snappy’, ‘deflate’}

Compression method. Defaults to “uncompressed”.

name

Schema name. Defaults to empty string.

Examples

>>> import pathlib
>>>
>>> df = pl.DataFrame(
...     {
...         "foo": [1, 2, 3, 4, 5],
...         "bar": [6, 7, 8, 9, 10],
...         "ham": ["a", "b", "c", "d", "e"],
...     }
... )
>>> path: pathlib.Path = dirpath / "new_file.avro"
>>> df.write_avro(path)

© 2020 Ritchie Vink
© 2022 Polars contributors
Licensed under the MIT License.
https://docs.pola.rs/api/python/stable/reference/api/polars.DataFrame.write_avro.html

Spec-Zone.ru

Настройки Оффлайн Что нового Помощь О нас
Spec-Zone .ru
спецификации, руководства, описания, API