Skip to content

SNOW-2044877: fix snowpandas in apply error msg#3678

Merged
sfc-gh-lmukhopadhyay merged 8 commits into
mainfrom
lmukhopadhyay-SNOW-2044877-fix-apply-error-msg
Sep 12, 2025
Merged

SNOW-2044877: fix snowpandas in apply error msg#3678
sfc-gh-lmukhopadhyay merged 8 commits into
mainfrom
lmukhopadhyay-SNOW-2044877-fix-apply-error-msg

Conversation

@sfc-gh-lmukhopadhyay

@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay commented Aug 19, 2025

Copy link
Copy Markdown
Contributor
  1. Which Jira issue is this PR addressing? Make sure that there is an accompanying issue to your PR.

    Fixes SNOW-2044877

  2. Fill out the following pre-review checklist:

    • I am adding a new automated test(s) to verify correctness of my new code
      • If this test skips Local Testing mode, I'm requesting review from @snowflakedb/local-testing
    • I am adding new logging messages
    • I am adding a new telemetry message
    • I am adding new credentials
    • I am adding a new dependency
    • If this is a new feature/behavior, I'm adding the Local Testing parity changes.
    • I acknowledge that I have ensured my changes to be thread-safe. Follow the link for more information: Thread-safe Developer Guidelines
    • If adding any arguments to public Snowpark APIs or creating new public Snowpark APIs, I acknowledge that I have ensured my changes include AST support. Follow the link for more information: AST Support Guidelines
  3. Please describe how your code solves the related issue.

    Updating Snowpark pandas in apply error message to a more relevant one

@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay added the NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs label Aug 19, 2025
Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay marked this pull request as ready for review August 19, 2025 23:27
@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay requested a review from a team as a code owner August 19, 2025 23:27
"pandas on Snowflake cannot be referenced within the pandas on Snowflake apply() function"
),
):
df.apply(lambda row: pd.to_datetime(f"{row.date} {row.time}"), axis=1)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what is confusing about these is that the pd. reference is modin.pandas not pandas. We may want to explicitly say that and mention that or illustrate with an example

import modin.pandas as pd
df.apply(lambda row: pd.to_datetime(f"{row.date} {row.time}"), axis=1)
import modin.pandas as pd
#...do stuff
import pandas
df.apply(lambda row: pandas.to_datetime(f"{row.date} {row.time}"), axis=1)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That makes sense I can add the import in the test itself to make it more clear. The example of apply with native pandas will go in the docs though right? There are already tests with df.apply(native_pd)

e
) or "Modin is not installed" in str(e):
raise SnowparkSQLException(
"pandas on Snowflake cannot be referenced within the pandas on Snowflake apply() function. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment below on more specific recommendations for how to fix this. We may want to add a stub in the documentation with an example and link to the docs from the error message.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean we should create a new section under Limitations that can be linked from this error message?

@sfc-gh-dolee sfc-gh-dolee left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left comments on error message

Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
e
) or "Modin is not installed" in str(e):
raise SnowparkSQLException(
"pandas on Snowflake cannot be referenced within the pandas on Snowflake apply() function. "

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Referring to "pandas on Snowflake" is also confusing here. I know it's our "official" name for the Snowpark pandas product, but users are likely to interpret it as just referring to pandas in general.

IMO it's better to make it more explicit that it's referring to modin, e.g. "modin.pandas cannot be referenced within a Snowpark pandas apply() function".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true, I followed the statement in the docs but this sounds clearer for this context

Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
Signed-off-by: Labanya Mukhopadhyay <labanya.mukhopadhyay@snowflake.com>
@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay merged commit c31c297 into main Sep 12, 2025
29 checks passed
@sfc-gh-lmukhopadhyay sfc-gh-lmukhopadhyay deleted the lmukhopadhyay-SNOW-2044877-fix-apply-error-msg branch September 12, 2025 07:17
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 12, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

NO-PANDAS-CHANGEDOC-UPDATES This PR does not update Snowpark pandas docs snowpark-pandas

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants