pymapd icon indicating copy to clipboard operation
pymapd copied to clipboard

load_table (rowwise) can be incorrect in presence of scientific notation

Open randyzwitch opened this issue 6 years ago • 1 comments
trafficstars

In working on #203, noticed that for bigint, if you have large enough numbers and have nulls, pandas will convert the column to float64 AND convert it to scientific notation. Loading the table rowwise into a pre-existing BIGINT column will convert the scientific notation float into a string, and OmniSci backend will truncate at the decimal point. So a gigantic number will be loaded as if it were 0-9, instead of a large number.

pseudocode:

data = np.random.randint(low=-9223372036854775807,
                                 high=9223372036854775807, size=n_samples,
                                 dtype='int64')

df = pd.DataFrame(data)

con.load_table("preexisting_int_table", df, method='rows') 

randyzwitch avatar Apr 10 '19 16:04 randyzwitch

Possible solution would be to explicitly format strings to some level of precision:

https://stackoverflow.com/a/33219633/2394542

randyzwitch avatar Apr 29 '19 16:04 randyzwitch