Skip to content
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

Lab 2 - Add penguins dataframe to duckdb #253

Open
durraniu opened this issue May 16, 2024 · 0 comments
Open

Lab 2 - Add penguins dataframe to duckdb #253

durraniu opened this issue May 16, 2024 · 0 comments

Comments

@durraniu
Copy link

There's this code to get penguins data from duckdb in lab 2:

import duckdb
con = duckdb.connect('my-db.duckdb')
df = con.execute("SELECT * FROM penguins").fetchdf().dropna()
con.close()

But penguins data does not exist as a table in duckdb yet. I suggest adding this after creating con:

from palmerpenguins import penguins
penguins_df = penguins.load_penguins().dropna()
con.sql("CREATE TABLE penguins AS SELECT * FROM penguins_df")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant