This episode dives into some of the most important data science libraries from the Python space
with one of its pioneers, Wes McKinney.
He's the creator or co-creator of the Pandas, Apache Arrow, and Evis projects,
as well as an entrepreneur in this space.
This is Talk Python to Me, episode 462, recorded April 11th, 2024.
Are you ready for your host?
You're listening to Michael Kennedy on Talk Python to Me.
Live from Portland, Oregon, and this segment was made with Python.
Welcome to Talk Python to Me, a weekly podcast on Python.
This is your host, Michael Kennedy.
Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython,
both on fosstodon.org.
Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
We've started streaming most of our episodes live on YouTube.
Subscribe to our YouTube channel over at talkpython.fm/youtube to get notified about upcoming shows and be part of that episode.
This episode is sponsored by Neo4j.
It's time to stop asking relational databases to do more than they were made for and simplify complex data models with graphs.
Check out the sample FastAPI project and see what Neo4j, a native graph database, can do for you.
Find out more at talkpython.fm/Neo4j.
And it's brought to you by Mailtrap, an email delivery platform that developers love.
Try for free at mailtrap.io.
Hey, Wes.
Welcome to Talk Python to Me.
Thanks for having me.
You know, honestly, I feel like it's been a long time coming having you on the show.
You've had such a big impact in the Python space, especially the data science side of that space.
And it's high time to have you on the show.
So welcome.
Good to have you.
Yeah, it's great to be here.
I've had my been heads down a lot the last, you know, and last N years.
And, you know, I actually haven't been because I think a lot of my work has been more like data infrastructure and and work working at even a lower level than than Python.
So I haven't been I haven't been as engaging as much directly with the with the Python community.
But it's it's been great to kind of get back more involved and start catching up on all the things that people have been building.
And and being at Posit gives me the ability to, yeah, sort of have more exposure to what's going on and people that are using Python in the real world.
There's a ton of stuff going on at Posit that's super interesting.
And we'll talk about some of that.
And, you know, it's sometimes it's just really fun to build, you know, and work with people building things.
And I'm sure you're enjoying that aspect of it.
For sure.
Nice.
Well, before we dive into Pandas and all the things that you've been working on after that, you know, let's just hear a quick bit about yourself for folks who don't know you.
Sure. Yeah.
My name is Wes McKinney.
I grew up in Akron, Ohio, mostly.
And I got involved, started getting involved in Python development around 2007, 2008.
And built I was working in quant finance at the time.
I started building a personal data analysis toolkit that turned into the Pandas project.
And then open source that in 2009, started getting involved in the Python community.
And, you know, I spent several years like writing my book, Python for data analysis, and then working with the broader scientific Python, Python data science community to help enable Python to become a mainstream programming language for doing data analysis and data science.
In the meantime, I've become an entrepreneur.
I've started some companies and I've been working to innovate and improve the computing infrastructure that powers data science tools and libraries like Pandas.
So that's led to some other projects like Apache Arrow and Ibis and some other things.
Since recent years, I've been working on a startup, Voltron data, which is still very much going strong and has a big team and is off to the races.
And I've had a long relationship with Posit, formerly RStudio.
And they were, you know, my home for doing aero development from 2018 to 2020.
They helped me incubate the startup that became Voltron data.
And so I've gone back to work full time there as a software architect to help them with their Python strategy to make sort of their data science platform a delight to use for the Python user base.
I'm pretty impressed with what they're doing.
I didn't realize the connection between Voltron and Posit, but I have had Joe Chung on the show before to talk about Shiny for Python.
And I've seen him demo a few really interesting things, how it integrates to notebooks these days.
Some of the stuff that y'all are doing.
And yeah, it's just it's fascinating.
Maybe give people a quick elevator pitch on that while we're on that subject.
On Shiny or on Posit in general?
Yeah, whichever you feel like.
Yeah.
So Posit started out 2009 as RStudio.
And so it didn't start out intending to be a company.
JJ Lair and Joe Chang built a new IDE, Integrated Development Environment, for R, because what was available at the time wasn't great.
And so they made that into, you know, I think probably one of the best data science IDs that's ever been built.
It's really an amazing piece of tech.
So I started becoming a company with customers and revenue in the 2013 timeframe.
And they've built a whole suite of tools to support enterprise data science teams to make open source data science work in the real world.
But the company itself, it's a certified B Corporation, has no plans to go public or IPO.
It is dedicated to the mission of open source software for data science and technical communication and is basically building itself to be a hundred year company that has a revenue generating enterprise product side and an open source side so that we the open source feeds the kind of enterprise enterprise part of the business.
It's the enterprise part of the business generates revenue to support the open source development.
And the goal is to be able to sustainably support the mission of open source data science, you know, for, you know, hopefully the rest of our hopefully the rest of our lives.
And it's an amazing company.
It's been one of the most successful companies that dedicates a large fraction of its engineering time to open source software development.
So it's very impressed with the company and, you know, JJ Lair, its founder.
And, you know, I'm excited to be, you know, helping it, helping it grow and, and become a sustainable long-term fixture in the, in the ecosystem.
Yes.
Yeah.
It's definitely doing cool stuff.
Incentives are aligned well, right?
It's not private equity or IPO.
Yeah.
Many people know JJ Lair created cold fusion, which is like the original dynamic web development framework in the 1990s.
And so, so he and his brother, he and his brother, Jeremy and some others built a layer corp to commercialize cold fusion.
And they built a successful software business that was acquired by macro media, which was eventually acquired by Adobe.
But they did go public as a layer corp.
And during the.com bubble, then JJ went on to found a couple of other successful startups.
And so he found himself in his late thirties in the 15 years ago or around, around age 40 is around, around the age I am now having been very successful as an entrepreneur, like no need to, to make money and looking for like a mission to spend the rest of his career on.
And that identifying data science and statistical computing as an open source in particular, like making open source for data science work, you know, was the mission that he aligned with and something that he had been interested in earlier in his career, but he had gotten busy with other things.
So it's really refreshing to work with people who are really mission focused and focused on making impact in the world, creating great software, empowering people, increasing accessibility and making most of it available for free on the internet and not being so focused on empire building and producing great profits for venture investors and things like that.
So I think, yeah, I think the, I think the goal of the company and, is to, you know, provide like a, you know, an amazing home for top tier software developers to work on this software, to, you know, spend their careers and to, to build families and, to be a happy, happy and healthy culture for working on this type of software.
That sounds excellent.
Very cool.
I didn't realize the history all the way back to cold fusion.
Speaking of history, let's jump in.
There's a, Wes, there's a possibility that people out there listening don't know what pandas is.
You would think it's pretty ubiquitous.
And I certainly would say that it is, especially in the data science space, but I got a bunch of listeners who listen and they say really surprising things.
They'll say stuff to me like, Michael, I've been listening for six weeks now and I'm starting to understand some of the stuff y'all are talking about.
I'm like, why did you list for six weeks?
You didn't know what I was talking about.
Like, that's crazy.
And a lot of people use it as like language immersion to get into the Python space.
So I'm sure there's plenty of people out there who are, you know, immersing themselves, but are pretty new.
So maybe for that crew, we could introduce what pandas is to them.
Absolutely.
It's a data manipulation and analysis toolkit for Python.
So it's a Python library that you install that enables you to read data files.
So read many different types of data files off of disk or off of remote storage or read data out of a database or some other remote data storage system.
This is tabular data.
So it's structured data like with columns.
You can think of it like a spreadsheet or some other tabular data set.
And then it provides you with this data frame object, which is kind of pandas dot data frame.
That is the main tabular data object.
And it has a ton of methods for accessing, slicing, grabbing subsets of the data, applying functions on it that do filtering and subsetting and selection, as well as like more analytical operations, like things that you might do with a database system or SQL.
So joins and lookups, as well as analytical functions, like summary statistics, you know, grouping by some key and producing summary statistics.
So it's basically a Swiss army knife for doing data manipulation, data cleaning and supporting the data analysis workflow.
But it doesn't actually include very much as far as actual statistics or models or, you know, if you're doing something with LLMs or linear regression or some type of machine learning, you have to use another library.
But pandas is the on ramp for all of the data into your environment in Python.
So when people are building some kind of application that touches data in Python, pandas is often like the initial like on ramp for how data gets into Python, where you clean up the data, you regularize, regularize it, you get it ready for analysis, and then you feed the clean data into the downstream, you know, statistical library or data analysis library that you're using.
That whole data wrinkling side of things, right?
Yeah, that's right.
That's right.
And so, you know, in some history, Python had arrays, like matrices and what we call tensors now, multidimensional arrays going back all the way to 1995, which is pretty, pretty early history for, for Python, like the Python programming language has only been around since like 1990 or 1991, if my memory serves.
But the numpy, what became numpy in 2005, 2006 started out as numeric in 1995.
And it provided numerical computing, multidimensional arrays, matrices, the kind of stuff that you might do might do in MATLAB.
But it was mainly focused on numerical computing, and not with the type of business data sets that you find in database systems, which contain a lot of strings or dates or non numeric data.
And so my initial interest was I found Python to be a really productive programming language, I really liked writing code in it, writing simple scripts, like, you know, doing random things, you know, for my for my job.
But then you had this numerical computing library, NumPy, which enabled you to work with large numeric arrays and large, you know, data sets with a single data type.
But working with this more tabular type data stuff that you would do in Excel or stuff that you do in a database, it wasn't very easy to do that with with NumPy or it wasn't really designed for that.
And so that's what led to building this like higher level library that deals with these tabular data sets in the pandas library, which was originally focused on, you know, building really with a really close relationship with NumPy.
So pandas itself was like a thin layer on top of NumPy originally.
This portion of Talk Python to me is brought to you by Neo4j.
I have told you about Neo4j, the native graph database on previous ad spots.
This time, I want to tell you about their relatively new podcast, Graph Stuff.
If you care about graph databases and modeling with graphs, you should definitely give it a listen.
On their season finale last year, they talked about the intersection of LLMs and knowledge graphs.
Remember when ChatGPT launched?
It felt like the LLM was a magical tool out of the toolbox.
However, the more you use it, the more you realize that's not the case.
The technology is brilliant, but it's prone to issues such as hallucinations.
But there's hope.
If you feed the LLM reliable current data, grounded in the right data and context, then it can make the right connections and give the right answers.
On the episode, the team at Neo4j explores how to get the results by pairing LLMs with knowledge graphs and vector search.
Check out their podcast episode on Graph Stuff.
They share tips for retrieval methods, prompt engineering, and more.
So just visit talkpython.fm/neo4j dash graph stuff to listen to an episode.
That's talkpython.fm/neo4j dash graph stuff.
The link is in your podcast player's show notes.
Thank you to Neo4j for supporting Talk Python to me.
One thing I find interesting about pandas is it's almost its own programming environment these days in the sense that, you know, traditional Python, we do a lot of loops.
We do a lot of attribute dereferencing, function calling.
And a lot of what happens in pandas is more functional.
It's more applied to us.
It's almost like set operations, right?
Yeah, lots of vector operations and so on.
Yeah, that was behavior that was inherited from NumPy.
So NumPy is very array-oriented, vector-oriented.
So you, rather than write a for loop, you would write an array expression, which would operate on whole batches of data in a single function call, which is a lot faster because you can drop down into C code and get good performance that way.
And so pandas adopted the, you know, the NumPy way of like the NumPy-like array expression or vector operations.
But it's true that that's extended to the types of like non-numeric data operations that you can do in pandas, like, you know, vectorized set lookups where you can say like, you would say like, oh, like this, I have this array of strings and I have this subset of strings.
And I want to compute a Boolean array, which says whether or not each string is contained in this set of strings.
And so in pandas, that's the isin function.
So you would say like column A, like isin some set of substrings and that produces that single function call produces a whole Boolean array that you can use for subsetting later on.
Yeah, there's a ton of things that are really interesting in there.
One of the challenges, maybe you could speak to this a little bit, then I want to come back to your performance comment.
One of the challenges, I think, is that some of these operations are not super obvious that they exist or that they're discoverable, right?
Like instead of just indexing into, say, a column, you can index on an expression that might filter out the columns or project them or things like that.
How do you recommend people kind of discover a little bigger breadth of what they can do?
There's plenty of great books written about pandas.
So there's my book, Python for Data Analysis.
I think Matt Harrison has written an excellent book, Effective Pandas.
The pandas documentation, I think, provides really nitty gritty detail about how all the different things work.
But when I was writing this book, Python for Data Analysis, my goal was to provide a primer, like a tutorial on how to solve data problems with pandas.
And so for that, I had to introduce some basics of how NumPy works so people could understand array-oriented computing, basics of Python, so you know enough Python to be able to understand what things that pandas is doing.
It builds incrementally, and so like as you go through the book, the content gets more and more advanced.
It introduces, you learn, you master an initial set of techniques, and then you can start learning about more advanced techniques.
So it's definitely a pedagogical resource.
And it is now freely, as you're showing there on the screen, it is freely available on the internet.
So JJ Allaire helped me port the book to use Quarto, which is a new technical publishing system for writing books and blogs and website, you know, Quarto.org.
And yeah, so that's how I was able to publish my book on the internet, as, you know, essentially, you can use Quarto to write books using Jupyter Notebooks, which is cool.
My book was written a long time ago in O'Reilly's Docbook XML, so not particularly fun to edit.
But yeah, because Quarto is built on Pandoc, which is a sort of markup language transpilation system.
So you can use Pandoc to convert from one, you know, you can to convert documents from one format to another.
And so that's the kind of the root framework that Quarto is built on for, you know, generating, starting with one document format and generating many different types of output formats.
That's cool. I didn't realize your book was available just to read on the internet.
Yeah.
Navigate around.
In the third edition, I was able to negotiate with O'Reilly and add a, you know, add an append and make an amendment to my very old book contract from 2011 to let me release the book for free on my website.
So it's, yeah, it's just available there at westmckinney.com slash book.
I find that like a lot of people really like the print book.
And so I think that having the online book just available, like whenever you are somewhere and you want to look something up is great.
Print books are hard to search.
Yeah, that's true. That's true. Yeah.
And like, if you go to the search bar and if you go back to the book and just look at the search bar, you know, look at just search for like group by like, you know, all one word or, you know, yeah, it's like it comes up really fast.
You can go to that section and it's pretty cool.
I thought that releasing the book for free online would would affect sales, but no, people just really like having paper books.
It seems even in 2024.
Yeah. Even digital books are nice. You got them with you all the time.
You can I think it's about taking the notes.
Where do I put my highlights and how do I remember it?
And that's right.
Yeah. Yeah. Stuff like that.
This quarter thing looks super interesting.
If you look at Pandoc, if people haven't looked at this before, the conversion matrix, I don't know how you would, how would you describe this, Wes?
Busy? Complete? What is this? This is crazy.
It's very busy. Yeah.
It can convert from looks like about, you know, 30 or 40 input formats to, you know, 50 or 60 output formats, maybe, maybe more than that.
Kind of like just my just eyeballing it. But yeah, it's like a pretty, pretty impressive.
And then if you took the combinatorial of like how many different ways could you combine the 30 to the 50?
It's kind of what it looks like. It's right.
It's truly amazing. So if you've got Markdown, you want to turn it into a PDF or you've got a, a Doku wiki and you want to turn it into an EPUB or whatever.
Right. Or even like reveal JS probably to PowerPoint, I would imagine. I don't know.
Yeah.
As history, like backstory about, about Quarto.
So, you know, it helps to keep in mind that, that JJ created ColdFusion, which was this, you know, essentially publishing system, early publishing system for the internet, similar to CGI and, and PHP and, and other dynamic web publishing systems.
And so at early on at RStudio, they created R Markdown, which is a, basically a extensions to Markdown that allow you to have code cells written in, in R. And then eventually they added support for some other languages where it's kind of like a Jupyter notebook in the sense that you could have some Markdown and some code and some plots and output.
And you would run the R Markdown renderer and it would, it would, it would, you know, generate all the output and insert it into the document.
And so you could use that to write blogs and websites and everything.
But, but R Markdown was written in R. And so that limited, in a sense, like it made it harder to install because you would have to install R to use it.
And also people, it had an association with R that perhaps was like, like unmerited.
And so in the meantime, you know, with, with all, all, everything that's happened with web technology, it's now very easy to put a complete JavaScript engine in a stall footprint, you know, on a machine with no dependencies and to be able to run a system that is, you know, written in a system that's written in JavaScript.
And so Cordo is completely language agnostic. It's written in TypeScript and it uses Pandoc as an, as an underlying engine.
And it's very easy to install. And so it addresses some of the portability and extensibility issues that were, that were present in R Markdown.
But, but as a result, you know, I think our, the, the Posit team had a lot of just has more than a, you know, a decade, or if you include ColdFusion, you know, more than 25 years of experience in, in building really developer friendly technical publishing tools.
And so I think that, that it's not data science, but it's something that is an important part of the data science workflow, which is how do you present your, make your analysis and your work available for consumption in different formats.
And so having this, this system that can, you know, publish outputs in, in many different places is, is super valuable.
So a lot of people start out in Jupyter notebooks, but, but there's many different, you know, many different possible input formats.
And so to be able to, you know, use the same source to publish to a website or to a Confluence page or to a PDF is like, yeah, it's super valuable.
Yeah. It's super interesting. Okay.
So then I got to explore some more. All right, let's go back to Pandas for a minute.
First, how about some kind words from the audience for you?
Ravid says, Wes, your work has changed my life. It's very, very nice.
I'm happy to hear it. But yeah, yeah, I'm more than happy to talk, let's talk in depth about Pandas.
And I think history of the project is, is interesting.
And I think also how the project has, has developed in the intervening 15, 16 years is, is pretty interesting as well.
Yeah. Let's talk derivatives for a minute.
So growth and speed of adoption and all those things.
When you first started working on this and you first put it out, did you foresee a world where this was so popular and so important?
Did you think of, yeah, pretty soon black holes. I'm pretty sure I'll be part of that somehow.
It was always the aspiration of making Python this mainstream language for statistical computing and data analysis.
Like I didn't, it didn't occur to me that it would become this popular or that it would become like the, one of the main tools that people use for working with data in a business, in a business setting.
Like that would have been, if that was the aspiration or if that was, you know, what I needed to achieve to be satisfied, that that would have been completely unreasonable.
And I also don't think that in a certain sense, like I don't know that, that it's popularity, it is deserved and it's not deserved.
Like I, I think there's, there's many other worthy efforts that have been created over the years that have been really great work that, that others have, have done in this, in this domain.
And so the fact that, that pandas caught on and became as popular as it is, I think it's a combination of timing.
And, you know, there was like a developer relations aspect that there was content available.
And like I wrote my book and that made it easier for people to learn how to use the project.
But also like we, we had a serendipitous open source developer community that, that came together that allowed the project to grow and expand like really rapidly in the early 2010s.
And I definitely spent a lot of work like recruiting people to work on the project and encouraging, you know, others to work on it.
Because sometimes people create open source projects and then it's hard for, hard for others to get involved and get a seat at the table, so to speak.
But I was very keen to bring on others and to give them responsibility and, you know, ultimately, you know, hand over the reins to the project to others.
And I've spoken a lot about that, you know, over the years, how important that is to, you know, for open source project creators to, to make room for others in, you know, steering and growing the project so that they can become owners of it as well.
It's tough to make space and tough to, to bring on folks.
Have you heard of the Django Nauts?
The Django Nauts, I think it's Django Nauts dot space.
They have an awesome domain, but it's basically like kind of like a bootcamp, but it's for taking people who just like Django and turn them into actually contributors or core contributors.
What's your onboarding story for people who do want to participate?
I'm embarrassed to say that I'm not, I don't have a comprehensive view of like all of the, the different, you know, community outreach channels that the Pandas project has done to help grow new contributors.
So one of the core team members, Mark Garcia has done an amazing job organizing documentation sprints and other like contributor sourcing events, essentially creating very friendly, accessible events where people who are interested in getting involved in Pandas can meet each other and then assist each other in making their first pull request.
And it could be something as simple as, you know, making a small improvement to the, to the Pandas documentation because it's such a large project.
The documentation is like, you know, either adding more, adding more examples or documenting things that aren't documented or making, yeah, just, just making the documentation better.
And so it's something that for new contributors is, is more accessible than working on the internals of like one of the algorithms or something.
And, and, or like we working on some significant performance improvement might be a bit intimidating if you've never worked on the Pandas code base.
And it's a pretty large code base because it's been, it's been worked on continuously for, you know, for like going on 20 years.
So it's, yeah, it can be, takes a while to really get to a place where you can be productive and that can be discouraging for new contributors, especially those who don't have a lot of open source experience.
That's one of the ironies of challenges of these big projects is they're just so finely polished.
So many people are using them.
Every edge case matters to somebody, right?
And so to become a contributor and make changes to that, it takes a while, I'm sure.
Yeah. Yeah.
I mean, I think it's definitely a big thing that helped is allowing people to get paid to work on Pandas or to be able to contribute to Pandas as, as a part of their job description.
Like as, you know, maybe part of their job is maintaining, maintaining Pandas.
So Anaconda, you know, was like, you know, one of the earliest companies who had engineers on staff, you know, like, you know, Brock Mendel, you know, Tom Augsberger, Jeff Reback, who part of their job was maintaining and developing, developing Pandas.
And that was, that was huge because prior to that, the project was purely based on volunteers.
Like I, I was a volunteer and everyone was working on the project as a, as a passion project in their, in their free time.
And then, Travis Oliphant, one of the founders, he and Peter Wang founded Anaconda.
Travis spun out from Anaconda to create Quonsight and has continued to sponsor development in and around Pandas.
And that's enabled people like Mark to do these community building events and, and for it to not be, you know, something that's, you know, totally uncompensated.
Yeah, that's a lot of, a lot of stuff going on.
And I think the commercial interest is awesome, right?
I mean, if there's just a different level of problems, I feel like we could take on, you know, you know what, I got this entire week and someone, that's my job is to make this work rather than I've, I've got two hours and can't really take on a huge project.
And so I'll work on the smaller improvements or whatever.
Yeah.
Many people know, but I, I haven't been involved day to day in Pandas since 2013.
So that's, that's getting on.
That's a lot of years.
You know, I still talk to the Pandas contributors.
Um, we had a, we had a Pandas meetup core, core developer meetup here in Nashville pre COVID.
I think it was in 2019 maybe.
So, you know, I'm still in active contact with the Pandas developers, but, it's been a different team of people leading the project.
It's taken on a life of its own, which is, which is amazing.
That's exactly.
Yeah.
As a project creator, that's exactly what you want is to not be beholden to the project that you created and forced and, you know, kind of.
Have to be, be responsible for it and take care of it for the rest of your life.
But if you look at like a lot of the community, a lot of the most kind of intensive community development has happened since, like, since I, I moved on to work on, on other projects.
And so now the project is, I don't know the exact count, but it's had thousands of contributors.
And so, you know, to have thousands of different unique individuals contributing to an open source project is, it's a big deal.
So I think even, I don't know what it says on the bottom of, on the bottom of GitHub, it says, you know, 30,
30, 200 contributors, but that's maybe not even the full story because sometimes, you know, people, they don't have their email address associated with their GitHub profile and, you know, how GitHub counts contributors.
You know, I would say probably the true number is closer to 4,000.
That's a testament, you know, to the, to the core team and all the outreach that they've done and work making, making the project accessible and easy to contribute to.
Because if people, if you go and try to make a pull request to a project and there's many different ways that, that you can fail.
So like either the project is technically like there's issues with the build system or the developer tooling.
And so you struggle with the developer tooling.
And so if you aren't working on it every day and every night, you can't make heads or tails of how the developer tools work.
But then there's also like the level of accessibility of the core development team.
Like if they don't, if they aren't there to support you in getting involved in the project and learning how it works and creating documentation about how to contribute and what's expected of you, that can also be, you know, a source of frustration where people churn out of the project, you know, because it's just, it's too hard to find their sea legs.
And maybe also, you know, sometimes development teams are unfriendly or unhelpful or, you know, they make, they make others feel like they make others feel like they're annoyed with them or like they're wasting their time or something.
It's like, I don't want to look at your, you know, this pull request and give you feedback because, you know, I could do it more quickly by myself or something.
Like sometimes you see that at open source projects.
Yeah.
But they've created a very welcoming environment.
And yeah, I think the contribution numbers speak for themselves.
They definitely do.
Maybe the last thing before we move on to the other stuff you're working on, but the other interesting GitHub statistic here is the used by 1.6 million projects.
That's, I don't know if I've ever seen it used by that high.
There's probably some that are higher, but not many.
Yeah.
It's a lot of projects.
I think it's, it's interesting.
I think like many projects, it's reached a point where it's, it's an essential and assumed part of the, of many people's toolkit.
Like they, like the first thing that they write at the top of a file that they're working on is important.
Import pandas as PD or import numpy as PD, you know, to create, I think in a sense, like, I think one of the reasons why, you know, pandas has gotten so popular is that it is beneficial to the community, to the Python community to have fewer solutions.
Kind of the zen of Python.
There should be one and preferably only one obvious, obvious way to do things.
And so if there were 10 different pandas like projects, you know, that creates skill portability problems.
And it's just easier if everyone says, oh, we just pandas is the thing that we use and you change jobs and you can take all your skills, like how to use pandas with you.
And I think that's also one of the reasons why Python has become so successful in the business world is because you can teach somebody even without a lot of programming experience, how to use Python, how to use pandas and become productive doing basic work very, very quickly.
And so one of the solutions I remember back in the early 2010s, there were a lot of articles and talks about how to address the data science shortage.
And my belief and I gave a I gave a I gave a talk at Web Summit in Dublin in 2000.
Gosh, maybe 2017, 2000.
I have to look exactly.
But basically, it was the data scientist shortage.
And my thesis was always it's we should make it easier to be a data scientist or like like lower the bar for like what sort of skills you have to master before you can you can do productive work in a business setting.
And so I think the fact that that there is just pandas and that's like the one thing that people have to have to learn how to how to use is like their essential like starting point for doing any data work has also led to this piling on of like people being motivated to make this one thing better because it you know, you make improvements to pandas and they benefit millions of projects and millions of people around the world.
And that's yeah.
So it's like a, you know, steady snowballing effect.
This portion of Talk Python to Me is brought to you by Mailtrap, an email delivery platform that developers love.
An email sending solution with industry best analytics, SMTP and email API SDKs for major programming languages and 24 seven human support.
Try for free at mailtrap.io.
I think doing data science is getting easier.
We've got a lot of interesting frameworks and tools.
Yeah.
For Python, one of them, right?
That makes it easier to share and run, run your code, you know?
Yeah.
Shiny, Shiny for Python, Streamlit, you know, Dash, like these different interactive data application publishing frameworks.
So you can go from, you know, a few lines of pandas code, loading some data and doing some analysis and visualization to publishing that as an interactive website without having to know how to use any web development frameworks or Node.js or anything like that.
And so to be able to, you know, get up and running and build a working, you know, interactive web application that's powered by Python is, yeah, it's a game changer in terms of, you know, shortening end-to-end development life cycles.
What do you think about Jupyter Lite and these PyOxidide and basically Jupyter, Jupyter in a browser type of things?
Yeah.
WebAssembly and all that?
Yeah.
So definitely very excited about it.
I've been following WebAssembly in general.
And so I guess some people listening will know about WebAssembly, but basically it's a portable machine code that can be compiled and executed within your browser in a sandbox environment.
So it protects against security issues and allows, prevents, like the person who wrote the WebAssembly code from doing something malicious on your machine, which is very important.
Won't necessarily stop them from like, you know, mining cryptocurrency while you have the browser tab open.
That's a whole separate problem.
But it's enabled us to, you know, run the whole scientific Python stack, including Jupyter and NumPy and Pandas totally in the browser without, you know, having a client and server and needing to, you know, run a container someplace in the cloud.
And so I think in terms of creating application deployment, so like being able to deploy an interactive data application, like with Shiny, for example, without needing to have a server, that's actually pretty amazing.
And so I think that, you know, simplifies, opens up new use cases, like new application architectures and makes things a lot easier for, because setting up and running a server creates brittleness, like it has cost.
And so if the browser is doubling as your server process, like that's, I think that's really cool.
You also have like other projects like DuckDB, which is a high performance, embeddable analytic SQL engine.
And so, you know, now with DuckDB compiled to WASM, you can get a, you know, high performance database running in your browser.
And so you can get low latency interactive queries and interactive dashboards.
And so it's, yeah, there's, WebAssembly has opened up this whole kind of new world of possibilities.
And it's transformative, I think.
For Python in particular, you mentioned Pyodide, which is kind of a whole package stack.
So it's like a framework for build and build and packaging and, you know, basically building an application and managing its dependencies.
So you could create a WebAssembly version of your application to be deployed like this.
But yeah, so I think one of the Pyodide, either the Pyodide main creator or maintainer went to Anaconda.
They created PyScript, which made, which is another attempt to make it even easier to use Python to, to make it even easier to use Python to create web applications, interactive web applications.
There's so many cool things here.
Like in the R community, they have WebR, which is, you know, similar to PyScript and Pyodide in some ways, like compiling the whole R stack to WebAssembly.
There was just an article I saw on Hacker News where they worked on, you know, figuring out how to get, how to trick LLVM into compiling Fortran code, like legacy Fortran code to WebAssembly.
Because when you're talking about all of this scientific computing stack, you need the linear algebra and all of the 40 years of Fortran code that have been built to support scientific applications.
Like you need all that to compile to and run in the browser.
So yeah, that's pretty wild to think of putting that in there, but very useful.
I didn't realize that you could use DuckDB as a WebAssembly component.
That's pretty cool.
Yeah, there's a company, I'm not an investor or plugging them or anything, but it's called evidence.dev.
It's like a whole like business intelligence, open source business intelligence application that's powered by, powered by DuckDB.
And so if you have data that fits in the browser, you know, to have a whole like interactive dashboard or be able to do business intelligence, like fully, like fully in the browser with no need of a, no need of a server.
It's, yeah, it's, it's very, very cool.
So I've been following DuckDB since the, you know, since the early days and, you know, my company Voltron Data, like we became members of the DuckDB Foundation and build, actively build a relationship with, with DuckDB Labs.
So we could help accelerate progress in this space because I think the impact, the impact is so, is so immense.
And we just, it's hard to predict like what, you know, what people are going to build, build with all this stuff.
Yeah.
And so that was all, you know, with, I guess, going back, you know, 15 years ago to Python, like one of the reasons I became so passionate about building stuff for Python was about in, I think the way that Peter Wang puts that, it puts it as, you know, giving people superpowers.
So we want to enable people to build things with much less code and much less time.
And so by making it things that much more accessible, that much easier to do, like the mantra in Pandas was like, how do we make things one line of code or like this, that must be easy.
It's like one line of code, one line of code.
It must be like, like make this as terse and simple and easy to do as possible so that you can move on and focus on building the more interesting parts of your application rather than struggling with how to read a CSV file or, you know, how to do whichever data munging technique that you need for your, for your data set.
Maybe an interesting mental model for DuckDB is kind of an equivalent to SQLite, but more analytics database for folks, you know, in process and that kind of things, right?
What do you think?
Yeah.
So yeah, DuckDB is like SQLite.
And in fact, it can run the whole SQLite test suite, I believe.
So it's a full database, but it's for analytic processing.
So it's optimized for analytic processing.
And as compared, you know, with SQLite, which is not for data processing.
Yeah.
Cool.
All right.
Well, let's talk about some things that you're working on beyond Pandas.
You talked about Apache Arrow earlier.
What are you doing with Arrow and how's it fit in your world?
The backstory there was, I don't know if you can hear the sirens in downtown Nashville, but...
No, actually, it's...
It's good.
It's filled.
The microphone filters it out, filters it out pretty well.
Yay for dynamic microphones.
They're amazing.
Yeah.
So in like around the mid, like the mid 2010s, 2015, I started working at Cloudera, like in
the...
Which is a company that was like one of the pioneers in the big data ecosystem.
And I had been spent several years working on five, five years, five, six years working on
Pandas.
And so I had gone through the experience of building Pandas from top to bottom.
And it was this full stack system that had its own, you know, mini query engine, all of
its own algorithms and data structures and all the stuff that we had to build from scratch.
And I started thinking about, you know, what if it was possible to build some of the underlying
computing technology, like data readers, like file readers, all the algorithms that power
the core components of Pandas, like group operations, aggregations, filtering, selection, all those
things.
Like what if it were possible to have a general purpose library that isn't specific to Python,
isn't specific to Pandas, but is really, really fast, really efficient.
It has a large community building, building it so that you could take that code with you
and use it to build many different types of libraries, not just data frame libraries, but
also database engines and stream processing engines and all kinds of things.
That was kind of what was in my mind when I started getting interested in what turned into
Arrow.
And one of the problems we realized we needed to solve, this was like a group of other open
source developers and me, was that we needed to create a way to represent data that was not
tied to a specific programming language.
And that could be used for a very efficient interchange between components.
And the idea is that you would have this immutable, this kind of constant data structure, which is
like it's the same in every programming language.
And then you can use that as the basis for writing all of your algorithms.
So as long as it's Arrow, you have these reusable algorithms that process Arrow data.
So we started with building the Arrow format and standardizing it.
And then we've built a whole ecosystem of components like library components and different programming
languages for building applications that use the Arrow format.
So that includes not only tools for building and interacting with the data, but also file
readers.
So you can read CSV files and JSON data and Parquet files, read data out of database systems.
Wherever the data comes from, we want to have an efficient way to get it into the Arrow format.
And then we moved on to building data processing engines that are native to the Arrow format so
that Arrow goes in, the data is processed, Arrow goes out.
So DuckDB, for example, supports Arrow as a preferred input format.
And DuckDB is more or less Arrow-like in its internals.
It has kind of Arrow format plus a number of extensions that are DuckDB specific for better
performance within the context of DuckDB.
So in numerous communities, so there's the Rust community, which has built Data Fusion, which
is an execution engine for Arrow, SQL engine for Arrow.
And so, yeah, we've kind of like looked at the different layers of the stack, like data
access, computing, data transport, everything under the sun.
And then we've built libraries that are across many different programming languages so that
are, you can pick and choose the pieces that you need to build your system.
And the goal ultimately was that we, in the future, which is now, we don't want people to
have to reinvent the wheel whenever they're building something like Pandas, that they could just
pick up these off-the-shelf components.
They can design the developer experience, the user experience that they want to create,
and they can get built.
You know, so if you were building Pandas now, you could build a Pandas-like library based on
the Arrow components in much less time.
And it would be fast and efficient and interoperable with the whole ecosystem of other projects that
use Arrow.
It's very cool.
It's, I mean, it was really ambitious in some ways, obvious to people.
They would hear about Arrow and they say, that sounds obvious.
Like, clearly we should have a universal way of transporting data between systems and processing
it in memory.
Why hasn't this been done in the past?
And it turns out that, as is true with many open source software problems, that many of these
problems are, the social problems are harder than the technical problems.
And so if you can solve the people coordination and consensus problems, solving the technical
issues is much, much easier by comparison.
So I think we were lucky in that we found like the right group of people, the right personalities
where we were able to, as soon as I met, I met Jacques Nadeau, who had been at MapR and
we was working on his startup, Dremio.
Like I knew instantly when I met Jacques Nadeau, I was like, I can work.
He's like, it's like him.
Like, he's going to help me make this happen.
And when I met Julien Ledem, who had also co-created Parquet, I was like, yes, like we are
going to make, like, I found the right people.
Like we are, we are going to make this happen.
It's been a labor of love and much, much work and stress and everything.
But I've been working on things circling, you know, with Arrow as the sun, you know, I've
been building kind of satellites and moons and planets circling the Arrow sun over the last
eight years or so.
And that's kept me pretty busy.
Yeah.
It's only getting more exciting and interesting.
Over here, it says it uses efficient analytic operations on modern hardware like CPUs and
GPUs.
One of the big challenges of Python has been the GIL.
Also one of its big benefits, but one of its challenges when you get to multi-core computational
stuff has been the GIL.
What's the story here?
Yeah.
So in Arrowland, when we're talking about analytic efficiency, it mainly has to do with the underlying,
like how the, how a modern CPU works or how a GPU works.
And so when the data is arranged in column oriented format that enables the data to be
moved efficiently through the CPU cache pipelines.
So the data is made, made available efficiently to the, to the CPU cores.
And so we spent a lot of energy in Arrow making decisions firstly to enable very cache of like
CPU cache or GPU cache efficient analytics on the data.
So we were kind of always, when we were deciding we would break ties and make decisions based
on like what's going to be more efficient for the, for the computer chip.
The other thing is that modern, and this is true with GPUs, which have a different parallelism
model than, or different kind of multi-core parallelism model than CPUs.
But in CPUs, they've focused on adding what are called single instruction, multiple data intrinsic,
like a built-in operations in the processor where, you know, now you can process up to 512
bytes of data in a single CPU instruction.
And so that's like, my brain's doing the math, right?
Like 16 32-bit floats or, you know, eight 64-bit integers in a single CPU cycle.
There's like intrinsic operations.
So multiply this number by that one, multiply that number to these eight things all at once,
something like that.
That's right.
Yeah.
Or you might say like, oh, I, I have a bit mask and I want to select, I want to gather
like the one bits that are set in this bit mask from this array of integers.
And so there's like a gather instruction, which allows you to select a subset sort of SIMD vector
of integers, you know, using a bit mask.
And so that turns out to be like a pretty critical operation in certain data analytic workloads.
So yeah, we were really, we wanted to have a data format that was essentially, you know,
future-proofed in the sense that it's, it's ideal for the coming wave, like current, current
generation of CPUs, but also given that a lot of processing is moving to GPUs and to FPGAs
and, and to custom silicon, like we wanted Arrow to be usable there as well.
And it's, Arrow has been successfully, you know, used as the foundation of GPU computing libraries.
Like we kind of at Voltron Data, we built, we've built a whole accelerator native GPU native,
you know, scalable execution engine that's, that's Arrow based.
And so I think the fact that we, that was our aspiration and we've been able to prove that out
in, in real world workloads and show the kinds of efficiency gains that you can get with using
modern computing hardware correctly, or at least as well as it's intended to be used.
That's a big deal in terms of like making applications faster,
reducing the carbon footprint of large scale data workloads, things like that.
Yeah. Amazing. All right. Let's see. What else have I got on deck here to talk
to you about? You want to talk IBIS or which one do you want to, we got a little time left. We got
a couple of things to cover.
Yeah. Let's, we can talk about IBIS. Yeah. We could, we could probably spend another hour talking.
Yes. Easy.
I think one of the more interesting areas in recent years has been new data frame libraries
and data frame APIs that transpile or compile to different execute on different backends. And so
around the time that I was helping start Arrow, I created this project called IBIS, which is basically
a portable data frame API that knows how to generate SQL queries and compile to pandas and polars and
different data frame, data frame backends. And the goal is to provide a really productive data frame
API that gives you portability across different execution backends with the goal of enabling what
we call the multi-engine data stack. So you aren't stuck with using one particular system because all of
the code that you've written is specialized to that system. You have this tool, which,
so maybe you could work with, you know, DuckDB on your laptop or pandas or polars with IBIS on your
laptop. But if you have, if you need to run that workload someplace else, maybe with, you know,
ClickHouse or BigQuery, or maybe it's a large big data workload that's too big to fit on your laptop
and you need to use Spark SQL or something that you can just ask IBIS, say, Hey, I want to do the same
thing on this larger data set over here. And it has all the logic to generate the correct query
representation and run that workload for you. So it's super useful, but there's a whole wave of like,
you know, work right now to help enable people to work in a pandas like way, but get work with big
data or, you know, get better performance than pandas because pandas is a Swiss army knife, but is,
isn't a chainsaw. So it, if you were rebuilding pandas from scratch, it would end up a lot.
There's areas of the project that are more bloated or have performance overhead. That's hard to get
rid of. And so that's why you have Richie Fink started the Polars project, which is kind of a
re-imagining of, of pandas, pandas dataframes written in Rust and exposed in Python. And Polars,
of course, is built on Apache Arrow at its core. So building an Arrow native dataframe library in Rust and,
you know, all the benefits that come with building Python extensions in Rust, you know,
you avoid the GIL and you can manage the multi-threading in a systems language, all that,
all that fun stuff.
Yeah. When you're talking about Arrow and supporting different ways of using it and things being built
on it, it's certainly Polars came to mind for me. You know, when you talk about IBIS, I think it's
interesting that a lot of these dataframe libraries, they try to base their API to be
pandas-like, but not identical potentially, you know, thinking of Dask and others.
But this IBIS sort of has the ability to configure it and extend it and make it different,
kind of like, for example, Dask, which is one of the backends here.
Yeah.
But the API doesn't change, right? It just, it talks to the different backends.
Yeah. There's different schools of thought on this. So there's another project called Moden,
which is similar to IBIS in many ways in the sense of like transpilation and sort of dynamically
supporting different backends, but sought to closely emulate exact details of like the API call,
the function name, the function arguments must be exactly the same as pandas to with the goal of
being a drop-in replacement for people's pandas code. And that's one approach, kind of the pandas
emulation route. And there's a library called Koalas for Spark, which is like a PySpark
emulation layer for the pandas API. And then there's other projects like Polars and IBIS,
Das DataFrame that take like design cues from pandas in the sense of like the general way in
which the API works, but has made meaningful departures in the interest of doing things
better in many ways than pandas did in certain parts of the API and making things simpler and not
being beholden to decisions that were made in pandas, you know, 15 years ago.
Not to say there's anything bad about the pandas API, but like with any API, it's large,
like it's, it's very large as evidenced by, you know, the 2000 page pages of documentation.
And so I understand the desire to make things simpler while also refining certain things,
making certain types of workloads easier to easier to express. And so Polars, for example,
is very expression based. And so everything is column expressions and is lazy and not eagerly
computed. Whereas pandas is eager execution, just like NumPy is, which is how pandas became eagerly
executed in the first place. And so I think the mantra with Polars was we don't want to support the
eager execution by default that pandas provides. We want to be able to build expressions so that we can
do query optimization and take inefficient code and under the hood, rewrite it to be more efficient,
which is, you know, what you can do with a query optimizer.
And so ultimately like that matters a lot when you're executing code remotely or in like a big
data system, you want to have the freedom to be able to take like a lazy analytic expression and
rewrite it based on, it might be like, you need to seriously rewrite the expression in the case of
like Dask, for example, like Dask has to do planning across a distributed cluster. And so, you know,
Dask data frame is very pandas like, but it also includes some explicit details of being able to
control how the data is partitioned and being able to have some knobs to turn in terms of like
having more control over what's happening on a distributed cluster. And I think the goal there
is like to give the developer more control as opposed to like trying to be intelligent, you know,
make all of the decisions on behalf of the developer. So, you know, if you know about how,
you know, know a lot about your data set, then you can make more, you can make, you know,
decisions about how to schedule and execute it. Of course, Dask is building, you know,
query optimization to start making more of those decisions on behalf of the user. But,
you know, Dask has become very popular and impactful and making distributed computing easier in Python.
So they've gotten, I think, gotten a long way without turning into a database. And I think Dask
never aspired to be a, to be a database engine, which is a lot of distributed computing is, you know,
not database like it's could be distributed array computing or distributed model training and
just being able to easily run distributed Python functions on a cluster, do distributed computing
that way. It was amazing. Like how many people were using PySpark in the early days, just for the
convenience of being able to run Python functions in parallel on a cluster.
Yeah. And that's pretty interesting. Not exactly what it's designed for.
Right.
You know, you probably come across situations where you do a sequence of operations. They're kind of
commutative in the end and practice, but from a computational perspective, like how do I distribute
this amongst different servers? Maybe one order matters a lot more than the other performance,
you know?
Yeah.
Yeah. Interesting. All right. One final thing. SQLglot.
Yeah. So SQLglot project started by Toby Mao. So he's a Netflix alum and, you know, really,
really talented, talented developer who's created this SQL query transpilation framework library for Python.
And, you know, kind of underlying core library. And so the problem that's being solved there is that
SQL, despite being a quote unquote standard, is not at all standardized across different database
systems. And so if you want to take your SQL queries written for one engine and use them someplace else,
without something like SQLglot, you would have to manually rewrite and make sure you get the
typecasting and coalescing rules correct. And so SQLglot has, understands the intricacies and the
quirks of every database dialect, SQL dialect, and knows how to correctly translate from one dialect
to another. And so IBIS now uses SQLglot as its underlying engine for query transpilation and
generating SQL outputs. So originally IBIS had its own kind of bad version of SQLglot, kind of a query
transpile, like SQL transpilation that was powered by, I think, powered by SQLAlchemy and some,
a bunch of custom code. And so I think they've been able to delete a lot of code in IBIS by moving to
SQLglot. And I know that, you know, SQLglot is also, you know, being used to power kind of a new,
yeah, being used in people building new products that are Python powered and things like that.
So, and Toby, like his, his company, Tobiko data, they, yeah, they're, they're building a product
called SQL mesh that's powered by SQLglot. So very cool project and maybe a bit in the weeds,
but if you've ever needed to convert a SQL query from one dialect to another, it's a, yeah,
SQLglot is here to save the day.
I would say, you know, even simple things is how do you specify a parameter variable,
you know, for a parameterized query, right? And Microsoft SQL server, it's like at the very,
the, the parameter name and Oracle, it's like question mark or SQLite. I think it's also,
you know, just that, even those simple things.
It's a pain, yeah.
And without it, you end up with little Bobby tables, which is also not good. So.
That's true. That's true.
Nobody wants to talk to him. Yeah, this is really cool. SQLglot, like polyglot,
but all the languages of SQL. Nice. And you do things like, you can say,
read DuckDB and write to Hive or read DuckDB and then write to Spark or,
or whatever. It's pretty cool. Yeah. All right, Wes, I think we're getting short on time,
but you know, I know everybody appreciated hearing from you and hearing what you're up to these days.
Anything you want to add before we wrap up?
I don't think so. Yeah. I enjoyed the conversation and yeah, there's a lot of stuff going on and
still plenty of things to get, get excited about. So I think often people feel like all the exciting
problems in the Python ecosystem have been solved, but there's still a lot to do. And yeah, we've made
a lot of progress in the last 15 plus years, but in some ways feels like we're just getting started.
So we are just excited to see where things go next.
Yeah. Every time I think all the problems are solved, then you discover all these new things
that are so creative and you're like, oh, well, that was a big problem. I didn't even know it was a
problem. It's great. All right. Thank you for being here and taking the time and keep us updated on what
you're up to. All right. Thanks for joining us. Bye-bye. Bye-bye.
This has been another episode of Talk Python to Me. Thank you to our sponsors. Be sure to check
out what they're offering. It really helps support the show. It's time to stop asking relational
databases to do more than they were made for and simplify complex data models with graphs.
Check out the sample FastAPI project and see what Neo4j, a native graph database, can do for you.
Find out more at talkpython.fm/Neo4j. Mailtrap, an email delivery platform that developers love.
Try for free at mailtrap.io. Want to level up your Python? We have one of the largest catalogs of Python
video courses over at Talk Python. Our content ranges from true beginners to deeply advanced topics like
memory and async. And best of all, there's not a subscription in sight. Check it out for yourself
at training.talkpython.fm. Be sure to subscribe to the show. Open your favorite podcast app and search
for Python. We should be right at the top. You can also find the iTunes feed at /itunes,
the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
We're live streaming most of our recordings these days. If you want to be part of the show and have
your comments featured on the air, be sure to subscribe to our YouTube channel at talkpython.fm
slash YouTube. This is your host, Michael Kennedy. Thanks so much for listening. I really appreciate
it. Now get out there and write some Python code.
Thank you.