-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SNOW-1269037: NaT (Not a Time) not parsed as NULL when session.create_dataframe
(throws exception instead)
#1331
Comments
session.create_dataframe
(throws exception instead)session.create_dataframe
(throws exception instead)
Hello @cvmartin , Thanks for raising the issue, we are looking into it. Regards, |
Hello @cvmartin , I tried the above sample code snippet with snowpatk 1.14.0 and its not throwing any error, following is the output code: df = pd.DataFrame( sf_df = session.create_dataframe( sf_df.schema Output: For both case whether I use None or valid date value, the output is same as above Regards, |
Hello @sfc-gh-sghosh. Thanks for your reply. The code that you provide I believe it does not make use of the Local Testing Framework, which is where I find the problem. Specifically, I miss the line
That indicates to create a Local Testing Framework connection named With the complete code, that looks like
I can reproduce the error, also with |
Thank you @cvmartin , We are able to reproduce the issue, we are looking into it, will update. Regards, |
Thanks a lot! |
PR is merged and will be part of the next release |
I'm closing the issue as the PR has been merged the released. please feel free to reach out if you still see issues. |
Please answer these questions before submitting your issue. Thanks!
What version of Python are you using?
3.11.7
What are the Snowpark Python and pandas versions in the environment?
pandas==1.5.3
snowflake-snowpark-python==1.12.0
What did you do?
The following code works as expected:
I get
StructType([StructField('"date"', TimestampType(), nullable=True)])
. Specifying the schema is not even necessary. What is important is specifyingutc=True
; otherwise the column is coerced to aLongType()
.Now, if one of the values of the date vector is coerced into a
NaT
value (not a time):The snippet above throws a very clear exception, indicating that
NaT
s are not supported:TypeError: not supported type: <class 'pandas._libs.tslibs.nattype.NaTType'>
This behavior does not happen out of the Local Testing framework. Using a "real snowflake session", the dataframe is properly created, parsing
NaT
as NULL:Also,
NaN
values work alright inside the Local Testing framework. In other words, if the snipped above would have used a numeric column, it would have worked fine. It is only with time values (NaT
) when the problem arises.The text was updated successfully, but these errors were encountered: