psabela
psabela

Reputation: 384

How to convert pandas dataframe to snowpark dataframe?

How to convert pandas dataframe back to snowpark dataframe?

pandas_df = snowpark_df.to_pandas()
...
???

Upvotes: 8

Views: 25307

Answers (2)

Emile Dimas
Emile Dimas

Reputation: 11

I am late but here you go:

import pandas as pd
from snowflake.snowpark import Session, Table


session: Session = ...
table_name = "table"
column_name = "column"

pandas_df = pd.DataFrame({"table_name": [table_name], "column_name": [column_name]})

snowpark_df = session.create_dataframe(data=pandas_df)

Upvotes: 1

Chris
Chris

Reputation: 195

Try this:

session.create_dataframe(pandas_df)

or alternatively this:

session.write_pandas(pandas_df, ...)

You can read about it in the docs here and here.

Upvotes: 13

Related Questions