Skip to content

SNOW-902906: Nan values get converted to null when using write_pandas from snowflake-connector-python or snowflake-snowpark-python #1717

@BrunoGarciaTejada

Description

@BrunoGarciaTejada

Python version

3.8

Operating system and processor architecture

Windows-10-10.0.22000-SP0

Installed packages

numpy==1.24.4
pandas==2.0.3
snowflake-connector-python==3.1.0
snowflake-snowpark-python==1.7.0

What did you do?

import numpy as np

import pandas as pd
import snowflake.connector
from snowflake.connector.pandas_tools import write_pandas

connector = snowflake.connector.connect(
    **{
        'user': '',
        'account': '',
        'database': '',
        'schema': '',
        'warehouse': '',
        'role': '',
        'authenticator': ''
    }
)

df = pd.DataFrame({'a': [1,2,3], 'b': [4,5,6], 'c': [np.nan,8.0,np.inf]})
df = df.replace(2, None)

write_pandas(connector, df, "output_table", table_type='', quote_identifiers = False, overwrite = True, auto_create_table=True)

What did you expect to see?

The same problem happens when using snowflake.snowpark.Session.write_pandas

  • Expected Results:

image

  • Actual Results:

image

Can you set logging to DEBUG and collect the logs?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions