Reading Data Frame in Atoti?

237 Views Asked by At

While reading Dataframe in Atoti using the following code error is occured which is shown below.

#Code global_data=session.read_pandas(df,keys=["Row ID"],table_name="Global_Superstore")

#error

ArrowInvalid: Could not convert '2531' with type str: tried to convert to int64

How to solve this? Please help guys..

Was trying to read a Dataframe using atoti functions.

1

There are 1 best solutions below

0
Ben Herro On

There are values with different types in that particular column. If you aren't going to preprocess the data and you're fine with that column being read as a string, then you should specify the exact datatypes of each of your columns (or that particular column), either when you load the dataframe with pandas, or when you read the data into a table with the function you're currently using:

import atoti as tt

global_superstore = session.read_pandas(
    df, 
    keys=["Row ID"],
    table_name="Global_Superstore",
    types={
        "<invalid_column>": tt.type.STRING
    }
)