Reply To: [Pro Tip] [Dyskusja] 'Szybkie' skrypty w Pythonie

  • Mateusz Wąsalski

    Organizer
    2024-11-08 at 15:33
    83 Punkty

    Tworzenie plików .parquet:

    import pandas as pd

    import pyarrow as pa

    import pyarrow.parquet as pq

    # dataframe

    data = {

    ‘Date’: [],

    ‘Name’: [],

    ‘Surname’: [],

    ‘Country’: [],

    ‘Value’: []

    }

    df = pd.DataFrame(data)

    # dataframe to table

    table = pa.Table.from_pandas(df)

    # table to parquet_file

    pq.write_table(table, ‘config_table.parquet’)