
Shiny 1.2 Release: Wrap your data frame with Narwhals! 🎉 | Barret Schloerke | Posit
In this video, Barret Schloerke from the Shiny team walks us through the exciting features of Shiny 1.2. One of the major updates includes the integration of Narwhals, allowing effortless computation on data frames without needing detailed knowledge of the data structure. Barret also demonstrates a simple Shiny app displaying S&P 500 data using PyArrow, Polars, and Narwhals. Learn how these updates simplify your data workflows, with minimal code needed to run complex data frame operations. Useful Links: • Shiny Component Gallery: [https://shiny.posit.co/py/components/] • Learn more about Narwhals: [https://narwhals-dev.github.io/narwhals/] Timestamps: 0:00 - Introduction and Shiny 1.2 Release Overview 0:12 - Narwhals Integration and Data Computation 0:31 - PyArrow Application Code Breakdown 1:20 - Using S&P 500 Data with Pandas, Polars, PyArrow, and Narwhals #Shiny #DataScience #narwhals #ShinyApp #Polars #Python
image: thumbnail.jpg
Transcript#
This transcript was generated automatically and may contain errors.
Hi everyone, my name is Barret Schloerke and I'm on the Shiny team at Posit. Shiny team just came out with a new release of Shiny, version 1.2. In this release, we've integrated Narwhals, which allows us to wrap your data frame and allow us to do computations on it without knowing specific knowledge of your data frame. This is great because Narwhals is improving by the hour, and it's really neat to see their progress so quickly.
This is great because Narwhals is improving by the hour, and it's really neat to see their progress so quickly.
Today, I'm going to show you a simple app, how we show some PyArrow data, and I'm going to show you all the different types that I can currently display. So let's check out this PyArrow application.
Walking through the PyArrow app
In a pretty format, it has 11 lines of code, but really, the magic all happens in these last three lines where we render a data frame. Let's run this app.
Our data is coming from the great tables package with the SMP 500, and we're using PyArrow table to import that pandas data set. Given this PyArrow data, we can just use it like normal, and it shows up in our app. That's pretty awesome. There's like roughly three, four lines of code involved for the user, and it works seamlessly.
Comparing pandas, Polars, PyArrow, and Narwhals
If we check out an app where we're looking at both pandas, polars, which was added in Shiny 0.9, but PyArrow and Narwhals support was added now in 1.2. So let's run this app. It's a little bit longer because there's more options, but the same concept still exists.
So the SMP 500 given pandas data set as your original data, we have polars, we have PyArrow, and if you happen to just return Narwhals itself, you can do that as well. There are new methods being displayed for your render data frame, and please check them out.
To learn more about this, check out PyShiny website component gallery, which will be linked down below. Also, check out Narwhals so that you can see the latest support and what they have for their eager data frames.


