DuckDB in Python - The Next Pandas Killer?

แชร์
ฝัง
  • เผยแพร่เมื่อ 25 ธ.ค. 2024

ความคิดเห็น •

  • @graymars1097
    @graymars1097 3 หลายเดือนก่อน +17

    I never tried duckdb but I'm convinced now thanks to you
    Pandas is great but "I can't query a DF like it's a DB using SQL" was one of my first compliants using pandas and "it needs its own process" is a huge deal breaker for data analysis specially in finance
    This solves all these problems 😮
    Great video 😊

  • @NathanaelNewton
    @NathanaelNewton 26 วันที่ผ่านมา +1

    Wow this looks great!
    I'm at that point in life where i need to graduate from spreadsheets and learn how to use databases and an acquaintance said to check out duckDB
    Thanks for making this! Lots of potential here

  • @rsbenari
    @rsbenari 3 หลายเดือนก่อน +6

    Concise, complete, helpful. As usual. Thanks.

  • @jaybakerwork
    @jaybakerwork 3 หลายเดือนก่อน +4

    Big big fan of DuckDB. It is nice to be able to switch to SQL for some things. The engine is great. Pairing it with MotherDuck opens up some nice options.
    I like the relational api too.
    I switch between duckdb and polars.

  • @RobSeward7
    @RobSeward7 2 หลายเดือนก่อน

    Love duckdb. I love this video. A comparison to polars would have been interesting too!

  • @pawjast
    @pawjast 3 หลายเดือนก่อน

    I would have never thought duckDB is so versatile and really cool replacement for Pandas even when working with local files!

  • @InhumanBean
    @InhumanBean 3 หลายเดือนก่อน

    Really great intro, thank you for making this.

  • @nocturnomedieval
    @nocturnomedieval 3 หลายเดือนก่อน +13

    This time every new tool seems faster than pandas even after the 2.0 arrow-based upgrade

    • @maximilianrausch5193
      @maximilianrausch5193 3 หลายเดือนก่อน

      What else is faster?

    • @nocturnomedieval
      @nocturnomedieval 3 หลายเดือนก่อน

      @@maximilianrausch5193 polars, vaex

    • @nocturnomedieval
      @nocturnomedieval 3 หลายเดือนก่อน

      ​@@maximilianrausch51931:27 polars and vaex are examples

    • @tedarcher9120
      @tedarcher9120 3 วันที่ผ่านมา

      ​@@maximilianrausch5193polar

    • @tedarcher9120
      @tedarcher9120 3 วันที่ผ่านมา

      I think pandas 2.0 is fast enough, switching from all the df support for 10-30% is not worth it

  • @thenderaaa9252
    @thenderaaa9252 3 หลายเดือนก่อน +2

    Neat, but: Running the test with the DuckDB process second each time means possible skew due to OS caching. I would have run the test again with Pandas second. Would it have made a difference? One way to find out ....

  • @dandyexplorer4252
    @dandyexplorer4252 3 หลายเดือนก่อน +3

    Can you compare the speed of polars and duckdb?

  • @Andrew-ud3xl
    @Andrew-ud3xl 3 หลายเดือนก่อน +1

    For the speed this is very comparable to polars, I started using SQL within polars but have switched to using duckdb due to duck showing where errors come from and i dont think polars sql has all the functionality of duck.
    Being able to save as a dataframe is nice to change things such as date columns to UK format and the display options of the output table.

  • @Jianfeng-ny7to
    @Jianfeng-ny7to 3 หลายเดือนก่อน +2

    when considering the speed, how about the use pd.read_csv, engine="pyarrow"? which is also very fastly load the big csv file

  • @rohitpammi
    @rohitpammi 3 หลายเดือนก่อน +1

    Really very informatic, thanks for sharing.

  • @carlmunkby6140
    @carlmunkby6140 3 หลายเดือนก่อน +6

    Any plans for making a video about airflow?

  • @vuongphaminh2293
    @vuongphaminh2293 3 หลายเดือนก่อน

    Love your videos, very helpful and informative! I have a suggestion that you could consider using AI completion tools like SuperMaven, Copilot, Tabnine, Cursor, etc., to speed up your typing. Watching you type long code lines slowly can be a bit tedious.

  • @apefu
    @apefu 3 หลายเดือนก่อน

    So if you don't need the sugar, just use a db already? I can't stress how much time this insight has saved me. Especially for live data.

  • @andybecker5001
    @andybecker5001 3 หลายเดือนก่อน

    Duckdb is super convenient for one off analysis or those that don’t have extra hardware to run their own database server.

  • @goodmanshawnhuang
    @goodmanshawnhuang 3 หลายเดือนก่อน +1

    Thanks for the video,i am considering querying a large set from bigquery then output to a csv file but better zip it, any suggestions please? Thanks

  • @togai-dev
    @togai-dev 2 หลายเดือนก่อน

    Hi there, may I ask the theme name that you are using? Thanks

  • @BaronCorso
    @BaronCorso 3 หลายเดือนก่อน +1

    How about duckdb vs polars?

  • @nishantkumar9570
    @nishantkumar9570 3 หลายเดือนก่อน +1

    Can we do comparison between DuckDB vs Polars?

  • @lowkeygaming4716
    @lowkeygaming4716 3 หลายเดือนก่อน

    Thank you for another great video. I learned something new again.

  • @MrBrannfjell
    @MrBrannfjell 2 หลายเดือนก่อน

    First impression with duckdb: They dont seem to support dictionary by default, so lets say you just want to dump a python dictionary to a flattened table in duckdb, no go (best workaround thus far is to turn it into a pyarrow/dataframe first). If you want to import json, you first have to save it to a file, and then load that file. Thats stupid if you are already carrying the json text from etc a web request response. I might just be stupid, but the documentation doesn't seem to give examples on how to just load data into duckdb without going through a stupid data proxy. I was hoping I could avoid all that if I used duckdb.

  • @joeingle1745
    @joeingle1745 3 หลายเดือนก่อน +10

    Those two queries are CTEs (Common Table Expressions) not sub-selects. Nit picking, but there is a difference.

    • @NeuralNine
      @NeuralNine  3 หลายเดือนก่อน +2

      Thanks for the clarification! :)

    • @marvinalone
      @marvinalone 3 หลายเดือนก่อน

      In my point of view, you can treat CTE as sub-selects, it's just more clear and better readibility as it can reuse in the query statement. But yes, they do have some differences. In the video, the author called them 'sub selects' or 'sub queryies' I think is okay.

    • @joeingle1745
      @joeingle1745 3 หลายเดือนก่อน

      @@marvinalone Apart from the fact that they're not sub-selects...

  • @tmb8807
    @tmb8807 3 หลายเดือนก่อน

    I like this because anything that gives people more options is great.
    However an honest question - is the preference for SQL syntax an organic thing, or is it because of familiarity?
    I mean I totally get the dislike for the pandas API and I almost never use it myself now, unless I have to. But I find the cognitive load of both reading and writing SQL far greater than the expression syntax and method chaining of Polars. Is that just because I don't do enough SQL?

  • @timz2917
    @timz2917 3 หลายเดือนก่อน

    Is data transformation still better in Pandas or Polars? I appreciate that the analysis part is better in DuckDB.

  • @rolandocedeno6194
    @rolandocedeno6194 วันที่ผ่านมา

    Excellent!

  • @andreip9378
    @andreip9378 2 หลายเดือนก่อน

    15:47 - results of aggregations are different btw.

  • @jaybakerwork
    @jaybakerwork 3 หลายเดือนก่อน

    What is the go to screen capture that he is using that works on linux these days?

    • @nobiado484
      @nobiado484 3 หลายเดือนก่อน

      Same as rhe one for Windiws: OBS Studio.

  • @mapleigue
    @mapleigue 3 หลายเดือนก่อน

    Does anyone know how would this compare to a PySpark setup?

  • @booster404
    @booster404 3 หลายเดือนก่อน +2

    This makes my thinking even more true "you master python then you master everything"

  • @xade8381
    @xade8381 3 หลายเดือนก่อน

    would be great if you could also cover cozo DB

  • @christopherc4526
    @christopherc4526 3 หลายเดือนก่อน

    Well done. Thank you

  • @ravlel1085
    @ravlel1085 3 หลายเดือนก่อน +1

    speed comparison has inefficient Pandas code. Try this approach: df.loc[df['C']

  • @egonkirchof
    @egonkirchof 3 หลายเดือนก่อน +4

    Fun fact: after all these pandas killers people still are using pandas.

    • @gs-e2d
      @gs-e2d 3 หลายเดือนก่อน

      Pandas is a different use case

    • @egonkirchof
      @egonkirchof 3 หลายเดือนก่อน

      @@gs-e2d So they should be called Pandas Killer but is a different use case.

  • @alenmangafic9178
    @alenmangafic9178 28 นาทีที่ผ่านมา

    FireDucks will be the Pandas killer.

  • @matheuspegorari1094
    @matheuspegorari1094 3 หลายเดือนก่อน

    Wtf. Now I can use csv files as tables and query them with sql. I’ve only heard about this. But never seen it being done so easily

  • @Rothbardo
    @Rothbardo 3 หลายเดือนก่อน

    Answer = yes

  • @AleksaMilic-d2e
    @AleksaMilic-d2e 3 หลายเดือนก่อน

    Interesting

  • @ChristopherBruns-o7o
    @ChristopherBruns-o7o 3 หลายเดือนก่อน +2

    4:01 Lol he said INSERT INTO person.

  • @philtoa334
    @philtoa334 3 หลายเดือนก่อน +1

    Thx_.

  • @SuperLimeWorld
    @SuperLimeWorld 3 หลายเดือนก่อน

    Hi

  • @harikrishnanb7273
    @harikrishnanb7273 3 หลายเดือนก่อน

    not the next, it's the real killer

  • @iegorshevchenko8365
    @iegorshevchenko8365 3 หลายเดือนก่อน

    +++++++++

  • @HH-mw4sq
    @HH-mw4sq 3 หลายเดือนก่อน +1

    For the complex query, I have:
    query = """
    WITH filtered_data AS (
    SELECT job, AVG(age) as avg_age
    FROM personnel_df
    WHERE age > 25
    GROUP BY job
    ),
    job_counts AS (
    SELECT job, COUNT(*) as count
    FROM personnel_df
    GROUP BY job
    )
    SELECT fd.job, fd.avg_age, jc.count
    FROM filtered_data fd
    JOIN job_counts jc
    ON fd.job = jc.job
    WHERE jc,count > 1
    ORDER BY fd.avg_age DESC
    """
    print(conn.sql(query).df())
    I get the following error:
    Traceback (most recent call last):
    File "D:/python/DuckDB/foo1.py", line 60, in
    main()
    File "D:/python/DuckDB/foo1.py", line 55, in main
    print(conn.sql(query).df())
    duckdb.duckdb.ParserException: Parser Error: syntax error at or near ","
    I am running python3.12, using the IDLE interface. Can someone please explain how to correct this error?

    • @benrontol2010
      @benrontol2010 3 หลายเดือนก่อน +2

      probably this one "WHERE jc,count > 1", it should be "jc.count", period not comma.

    • @HH-mw4sq
      @HH-mw4sq 3 หลายเดือนก่อน +1

      @benrontol2010 - wow!!!! I looked that over about 100 times and missed that. Thank you very much.

    • @amalzulkipli2248
      @amalzulkipli2248 3 หลายเดือนก่อน

      @@benrontol2010 real chad!