- Podcasts
- Talk Python To Me
- #422: How data scientists use Python
About this episodeSee the full show notes for this episode on the website at talkpython.fm/422
Transcript
From the publisherThis transcript comes from the podcast’s own feed, shown as the publisher wrote it.
#422: How data scientists use Python
Regardless of which side of Python you sit on, software developer or data scientist, you surely know that data scientists and software devs seem to have different styles and priorities. Why is that? And what are the benefits as well as the pitfalls of this separation? That's the topic of this conversation with our guest, Dr. Jody Birchell, data science developer advocate at JetBrains.
This is Talk Python in Me, episode 422, recorded May 31st, 2023. Welcome to Talk Python in 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. Be careful with impersonating accounts on other instances, there are many.
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 brought to you by JetBrains, who encourage you to get work done with PyCharm.
Download your free trial of PyCharm Professional at talkpython.fm/done-with-PyCharm. And it's brought to you by Prodigy from Explosion AI. Spend better time with your data and build better ML-based applications with Prodigy, a radically efficient data annotation tool. Get it at talkpython.fm/Prodigy and use our code TALKPYTHON, all caps, to save 25% off a personal license.
Personally, I really enjoyed being there. I think it's probably the best conference that I go to yearly. And it's like the vibe is so nice. On this show, we're going to talk about how data scientists use Python, which is somewhat different than maybe a software developer we have, which I guess I'll put myself solidly into that camp.
Yeah. So I'm probably going hand in hand with maybe not being a developer. My story is perhaps a little unconventional. So my background is academic, like a lot of data scientists. And unsurprisingly, the first language that I learned was R because I was doing psychology and health sciences and a lot of statistics.
Because I really don't want to write that next chapter. I just don't. Exactly. Exactly. So I remember it. Like I actually had this long weekend and I worked my way through, I think it was Zed Shaw's Learn Python the Hard Way. This is showing my age, I think. I loved it. Like I completed the course in three days and then I didn't know what to do with Python because the stats libraries weren't as developed back then.
Of course, of course. You know, it's so funny. You are the third person to ask me in two weeks and no one has asked me this question for like two years. My PhD was in hurt feelings. Hurt feelings? Yeah. Okay. I say this a little bit blithely. So my PhD being in psychology, I was really interested in emotions research and relationships research.
So I kind of wanted to see what happens to people emotionally when close relationships go bad. And it's hurt feelings like things like, you know, infidelities, rejections, all of that. It's hurt. So I was just studying what generates like and regulates the intensity of hurt and studied that for four and a half years.
Sounds interesting. I'm sure there was a lot of data to process. There was a lot of data to process and a lot of very interesting statistics. That was sort of how I got into data science. I fell in love with stats in undergrad and just kept going down that path. I think a lot of people are drawn to data science, not with the intent of waking up one day and saying, I'm going to be a data scientist, but they're excited or inspired about something tangential.
And they're like, well, I really need to get something better than Excel to work on this. Absolutely. Yeah. Yeah. And we'll probably talk about this a little bit later about why data scientists use programming. And it kind of is like in some ways that need to jump from something way more powerful and reproducible than Excel.
Yeah. Yeah. For sure. So how about now? You said you've left academics. And what are you doing these days? Yeah. So that leap from academia was a long time ago now. I think that was like seven years again, showing my age. So for six of those years, I was a data scientist. So day to day was, you know, pretty varied, but the job I have now is very different.
But I'm definitely not marketing or sales. It's more if I think this is the right fit for you, I'll do it. So it's like the way I achieve that is really up to me. For me, I really kind of, I like to do a mixture of what I call internal and external activities. So external activities are actually kind of only tangentially related to the products.
So this would be an example of an external activity. It's just getting out there and educating people about data science or educating data scientists about technical topics, things like conference talks or webinars, you know, all this sort of stuff. And then internal stuff is more focused on maybe things a bit more related to the product.
You know, I had your colleague, Paul Everitt on and we actually talked, it's quite a while ago, a couple of years ago, three, four. And we had a whole episode on like a panel on what is the developer advocate, developer relations job. But it's, it just seems like such a great mix of you still get to travel a little bit, see people, but you also get to write code and work on, on influencing technology and products and stuff.
Like I hate the gatekeeping that can happen in tech communities. I think it's quite bad in terms of like people being intimidated by math in data science. And like, I'm here to say to you, if you want it, it's for you. It is a very cool field and yeah, it doesn't matter what background you come from.
I absolutely agree. And I was kind of hinting at that saying like a lot of people who don't see themselves as developers or programmers, like still find really great places, really great fits in data science and in programming as well. And I also want to second that I don't think you really need that much math.
Maybe if you're trying to build the next machine learning model platform, then yes. Okay. But that's not what most people do. They take the data, they clean it up. They do interesting visualizations and maybe put it into some framework for production. Right? Yeah. And the nice thing is the field is in such a point where you have so many frameworks or tools that will handle a lot of this stuff for you.
Like I'm not saying you don't need any understanding of what's going on under the hood, but you can learn it incrementally. A lot of it is like with software development where you develop that smell or that instinct for when something is not right. That will benefit you more than, you know, knowing how backpropagation works from a calculus perspective.
Like that stuff is maybe a bit too much. You don't necessarily need it. Yeah. Let's get into the main topic and talk a little bit about how does programming and Python differ on the data science side than say me as somebody who builds web apps. Yeah. And maybe we can start by doing an orientation to like, what does a data scientist do?
Because I think this confuses a lot of people. Yeah. Yeah. So basically the role of a data scientist is to sort of like, like the reason you would hire a data scientist is you have a bunch of data and you have an instinct that you can use that data to either improve your internal processes or sell some sort of IP.
Like absolutely fundamental questions. So you need to be a analyst before you need a data scientist, but your data scientists are more there to push the envelope in a data driven way. So we have two main outputs. I would say you can either create an analysis and do a report, or you can build some sort of model that will go into production.
Developers obviously, on the other hand, have a very different goal. Their goal is to create robust software systems. So the concerns that they have are things like latency, server load, downtime, things like that. And it's very interesting. And we'll talk about it a bit more when we talk about code, if we kind of get into that topic, but basically data scientists are not really interested in creating code for the long term.
Whereas the code becomes the product that software developers write often. And you have to think about things like legacy systems, because eventually every Greenfield project becomes a legacy system if it lasts for long enough. Yeah. If you're lucky, right? Because the alternative is it never really got used or it didn't add that much value and got discarded, shut down.
I do think it's super interesting to different life cycle of code on the data science side, because you might be just looking to explore a concept or understand an idea better and not necessarily ever intend to put it into production in the traditional software sense, right? So I've seen some pretty interesting code written that people would look at and go, oh my goodness, what is there's not even a function here?
How is this possible? You know, it's like copy and paste, reuse almost. And yet it really does go from having no idea to pictures and understanding and then maybe handing that off potentially to be written more robustly or better. Exactly. And it's really interesting. Like they're kind of two very different processes.
And there really wouldn't be that much discussion between the engineers and the data scientists during the research phase, which I do not advise. So what that means is the data scientists will come at the end and hand over this chunk of perhaps very difficult to read code to an engineer and be like, hey, so we need to implement this.
Or like one of the most interesting problems I think I ever solved in my career was basically I was working at a job board. We're trying to improve the search using natural language processing. So we had this idea that we could build a model that found out the probabilistic relations between skills and job titles.
And it was super interesting because we had to think about how we could search that vector space in really, really like quickly. Like instead of having to calculate the distance between that and every single vector, we had to work out how to do that more efficiently. That sort of stuff I really like because it's so applied and it's so like it's this really nice intersection between computer science and data science.
And it's like, well, you might be right. Or I'm here and you push a button and you get the answer or it runs or like, there's a really nice feedback of like, I built this thing and it's look, it's really connecting these people. And, you know, then it comes down to, can you do it in real time and other things like that.
But that's a really cool aspect of programming. This portion of Talk Python To Me is brought to you by JetBrains and PyCharm. Are you a data scientist or a web developer looking to take your projects to the next level? Well, I have the perfect tool for you, PyCharm. PyCharm is a powerful integrated development environment that empowers developers and data scientists like us to write clean and efficient code with ease.
Whether you're analyzing complex data sets or building dynamic web applications, PyCharm has got you covered. With its intuitive interface and robust features, you can boost your productivity and bring your ideas to life faster than ever before. For data scientists, PyCharm offers seamless integration with popular libraries like NumPy, Pandas, and Matplotlib.
You can explore, visualize, and manipulate data effortlessly, unlocking valuable insights with just a few lines of code. And for us web developers, PyCharm provides a rich set of tools to streamline your workflow. From intelligent code completion to advanced debugging capabilities, PyCharm helps you write clean, scalable code that powers stunning web applications.
Plus, PyCharm's support for popular frameworks like Django, FastAPI, and React make it a breeze to build and deploy your web projects. It's time to say goodbye to tedious configuration and hello to rapid development. But wait, there's more. With PyCharm, you get even more advanced features like remote development, database integration, and version control, ensuring your projects stay organized and secure.
I think it's kind of a shame that a lot of places do set up their engineering and data science teams so separately. Sure, we have quite different roles and we have quite different backgrounds sometimes. But I really think that having the two teams at least planning things together, you can really actually learn a lot from each other about how to approach problems.
When you were describing either having those groups really separated or working really closely together, maybe an analogous relationship that people could relate with is maybe front-end developers and people building the APIs and the back-end, right? Like the people doing React or Angular or Vue or whatever it is, you know, and the web design.
Having those completely separated as well is also, you know, it's terrible. Not a good idea. It doesn't make any sense. And like, I can totally understand it from the point of view of like team composition, because it is, I think, better to have all your data scientists together because they can learn from each other.
Why Python? Let's talk about how the research process works and maybe why that results in different priorities and styles of code and styles of engineering. It starts at a similar point to all software projects, which is business comes to you and they have some sort of goal. Sometimes it's very vague and you need to interpret that and turn it into an executable project.
But where the sort of uncertainty starts and like where it sort of becomes a research project rather than a project. And I don't know if I described that very well, but where it becomes research versus something you're building concretely is even know at the start of a research project, whether it's even possible to answer the question that you're being asked or build the internal product that you're being asked for.
You might not understand the domain entirely, right? You're trying to gain understanding even. In the very worst cases, you won't even know if you have the data because maybe your company has so much data and it's so poorly organized. Again, something I've seen that you don't even know if the data exists to answer this question.
So first is going and getting your data. And you spend quite a lot of time with the data because the data will be the one that tells you the story. It'll tell you whether what you even want is possible. And you probably like heard data scientists hammering on about, you know, garbage in, garbage out.
Like you can build the most beautiful, sophisticated model you want. But if you have crap data where there's no signal, you're not going to get anything because it's just not there. Like the relationship you're looking for is not there. Yeah. The side of that I've heard is 80% of the work is actually the data cleanup, data wrinkling, data gathering before you just magically hit it with a plot or something, right?
Absolutely. And it's interesting because that data cleaning, data wrangling step also doesn't happen in one go, especially if you're building a model. So what will happen is you'll try something out and you'll be like, okay, it didn't quite work. Maybe I need to manipulate the data in a different way or I need to create this new variable.
And then you'll go again. And it's this super iterative process where you have this tightly coupled relationship between both the models and the data. So it really is sort of, you know, how I was talking about the instinct. This is sort of where that comes in because you're going to spend like 80% of your time honing your skills.
But it's the most, I think, valuable part of the process. And if the signal's there, you can usually get away with using really dumb and simple models. You know, things that are unfashionable now like decision trees or linear regression. You can get away with them because you've just got such good data that just go with a simpler model.
It's got all the advantages. This is sort of, I think, what makes it different that you're sort of moving towards a goal, but you don't know what that goal is. Estimation's always hard, right? What I found is best is really just time boxing each step, seeing if you are up to where you thought you'd be up to by a certain point.
So I hate to be, it depends, you know. I get to say that though because, you know, I was a lead data scientist, so I earned that rank. It really does depend on the problem you need to solve. So typically business will have enough data to cover at least some of the use cases. So to give you a really concrete example, this job board that I was talking about that I worked at, we actually had like a bunch of different job boards across Europe.
So we had some that were a lot bigger like Germany or the UK. And we had some that were really small like Poland or Spain. And we wanted to build these multi-language models or models maybe for different languages. We played around with both. And I don't think we really had enough data to support the models in these smaller languages.
So the models were just not as good quality because we didn't have enough data. But for the bigger languages, we did. And then it sort of becomes a case of, okay, well, we have more data for these particular websites because they're the ones that are bringing the most revenue. So then it sort of became like, well, okay, maybe it's good enough that we improve the search on the most important ones.
And for the smaller ones, we just wait until we accumulate more data. So yeah, most of the time I found that there's a way to make it work for at least part of the solution. And then sometimes, like in the case of my last job, we had something like 170 billion auctions per day. So we had so much data.
They've got layers and layers of like chips on hardware and then chips or machines right next to the collectors and then on it, where it's all about how do we throw away, you know, terabytes of data down to get it to megabytes per second, right? Yeah, and it's interesting because what you can end up in this within those situations is even then you can have underrepresented groups.
If you go look at Stack Overflow Insights, they had a really great graph that shows you the popularity of Python over time. And there's just this huge inflection point around 2012. And I feel like that's when a lot of the data science libraries really came around and took off. It seems like there was a big inflection at one point, but, you know, why?
To be honest, I can talk about why I like Python from my background. I couldn't really tell you exactly what caused that takeoff. But, you know, apart from, you know, this idea that the libraries were maturing enough. But the thing is, looking even at current surveys, around 60% of data scientists do not have a software development or a software engineering background.
So, for people like us, we don't really understand, like, it sounds terrible. We don't really understand basic constructs in how a programming language works. And that can actually mean that going to some sort of compiled language even can be quite a steep learning curve. Sure. Pointers to pointers, for example.
But in Python and in R as well, you don't need to cover those things. It's super easy to prototype. It's super easy to script. The flexibility of Python is what makes it, I think, the perfect prototyping language. And that's essentially what you're doing. You're prototyping. So, we talked a little bit earlier about, like, why not just Excel?
You can use powerful data. Right? Like, I need live currency conversion data. Right? So much easier than in Excel. Yes, yes, yes, exactly. Like, you can, like, scrape data. Or you can, yeah, pull data in off an API. Or you can use powerful tools like Spark to process 170 billion auctions per day in order to reduce it down to something manageable.
So, yeah, it just gives you a lot more power. But at the same time, why we use programming languages is just such a different focus. It's a bit overkill to use something like Java. I know some people do do natural language processing in Java. But that's more on the engineering side to build maintainable systems.
One of the things I like to say when thinking about how people who are coming from a tangential interest like biology or whatever is you can be really effective with Python. And I suspect R as well with a really partial understanding of what Python is and what it does. Right? Like you pointed out, you don't even have to know what a class is or even really how to create a function.
You just, I can put these six magical incantations in a file and then I can do way more than I otherwise could. Right? Then you learn one more. You make it better and better as you kind of gain experience. Pretty much. And this is where I started. Like, obviously, I learned what functions and classes were when I first started programming.
But in the end, you will just, maybe it's not the best thing. And we can sort of maybe get into this. I suppose part of the confusion or not confusion, but internal debate I've had over the years is how good does data science code really need to be? Like, how much would data scientists benefit from knowing more about computer science topics?
Or software engineering topics maybe more to the point? And, you know, because like the thing is, every field has so much to learn. Don't even get started on what's happening with large language models at the moment. Like, it's just overwhelming. Should we take some of our precious time and learn software engineering concepts?
You can easily and visually annotate and develop data for named entity recognition, text classification, span, categorization, computer vision, audio, video, and more, and put your model in the loop for even faster results. After collecting data, you can quickly train and export a custom spaCy model or download annotations to use it with any other library or framework.
Prodigy is entirely scriptable in Python, of course, the language we all love. And it seamlessly integrates with your favorite libraries and tools. Plus, the new alpha version they just released also introduces a built-in support for large language models, such as OpenAI's GPT models, and new tools for dividing up your data between multiple annotators.
This link is in your podcast player show notes. Thank you to Explosion AI for sponsoring the show. I think it really depends on what kind of data scientist you are. If what you are is someone doing research, as you described before, and you're like, is there a trend between the type of device that they use to buy their thing at our store and how much they're buying on the second, you know, how much are likely to come back?
Like, if they're using an iPhone, do they tend to spend more than if they're using an Android? And is that a thing that we should consider? Or, you know, is there any, like that kind of exploration, which you can judge whether or not you should make that exploration. But just put that aside for a minute.
I'd say maybe not, honestly. On the other hand, if your job is to create a model that's going to go into production, that's going to run behind a Flask or FastAPI endpoint, then you're kind of in the realm of continuously running for many people over a long time. And I think that really is a different situation.
I think this is where you actually move from data science to machine learning engineering. This term has a lot of different definitions. For me, I base my definition of ML engineers on the two people that I've worked with, who were like true full stack kind of people who could go from research and prototyping to deployment.
So I think as good as your data scientist is going to be, or your ML engineer, let's say an ML engineer, let's say that they can actually deploy their own code. If they're then responsible for that code in production, that then eats up the time that they can be prototyping and researching new things for you.
So the conclusion I've come to over time, and again, this is a matter of a debate. This is just my opinion. Basically, I think if your company is above any sort of level of size or complexity, in terms of the data products it has, I think you really do need dedicated data science and engineering teams.
Because in the end, no matter how good your data scientist code is going to be, it needs to be implemented by the person who's going to maintain it. And maybe they're not the ones writing the code from scratch. Maybe they can adapt the data scientist code if it's good enough. But in the end, they need to be comfortable and familiar enough with that code to be like, yeah, if I get pinged at three in the morning, I'm okay knowing what to do with this code.
Yeah, that's a good point. Yeah. So I think it's just easier to scale these teams in parallel rather than trying to hire this like wall in one person who can do everything. They're impossible to hire. Like I've only ever met two over the course of my career. And quickly, they become overwhelmed by having to maintain projects.
Chris May has got an interesting question out here in the audience. This kind of turns us on its head a little bit. It says, development teams tend to work better when they focus on writing and refactoring code to make it testable and understandable. And we've talked a little bit about maybe stuff that data scientists shouldn't care about or whatever.
So he has other ideas that are like good practices for data scientists and teams of them. This is actually a really great question. So basically, it's an interesting thing with data scientists that unlike software developers, we often tend to work alone on projects or maybe in very, very small teams, like maybe two or three people.
So what I think has been neglected, you know, aside from learning software engineering best practices is more fundamental things, which is like writing maintainable code. And I don't mean maintainable in the sense of it's a system that needs to be able to run regularly. It's more like this is a piece of code that I can come back to in six months and understand what I was doing.
Because, you know, research projects can be shelved forever, but maybe they need to be revisited and, you know, built upon. So this was actually a topic I got really interested when I first moved to industry, like this idea of reproducibility with data science projects. It's about the code, but it's also about things like dependency management, which is notoriously...
Oh, yes. ...difficult in Python to get reproducible environments later. And even the operating system, if Linux is really dramatically changed over time, then maybe your old dependency, you want to keep that one, but it won't run on the new operating system or there's a whole spectrum of challenges there.
Exactly. Exactly. And it's sort of something that can be solved with using poetry, which is a little bit more robust. But even then, you've still got it. Like it runs on my machine effect where your machine will not be the same machine. Recently, there's actually a move towards doing more sort of cloud-based stuff for data science, which solves a few of these problems.
And it also solves the additional problem where data scientists often need to do remote development for various reasons. Like you need access to GPUs in order to train models. So, you know, obviously if you have a server, you have a Docker container, which has, you know, environment specifications, you can power up that exact same environment.
And that actually helps with that reproducibility a lot. And then another point, which I think is really important for data scientists and can be neglected is literate programming. So this is an idea from Donald Knuth. And it's this idea that, you know, you should write your code in such a way that it's actually understandable later.
With data science work, it's also that you really need to document a lot of the implicit kind of assumptions that you make or decisions that you make as part of the research process. And this is one of the reasons, probably a good segue, why Jupyter is so important. Yeah. Jupyter notebooks are designed to be research documents.
So this is why you have the markdown cells if you've seen a Jupyter notebook, because it's this idea that you really, really need to like document along with the code, the decisions that you made. Like, why did you choose this sample? Why did you decide to create the inputs to your models the way that you did it?
You need to document all this stuff. So yeah, reproducibility is a super interesting topic. And I think it's, yeah, something that really needs to be thought about carefully, even if you're not collaborating with anyone else, because otherwise your piece of research is going to be worthless in three months because you're not going to remember what you did.
I think notebooks are quite interesting. They go a long ways to solving that. When used in the right way, you can just jam a bunch of non-understandable stuff in there. And it's just, well, now it's not understandable, but it's in a web page instead of in an editor. But I think as in, you know, not just programmers, but tech in general, we're just bad at thinking about the long-term life cycle of information and compute.
For example, I got a new heat pump to replace the furnace at my house. The manual for it came on a CD drive. And I'm like, I don't think I have a CD. Where did I put that? I went to go dig through closet full of electronics. I'm not sure I can read that, right? And, you know, CD seems so ubiquitous for so long, right?
Some of them haven't been updated from Python 2. So I can't use them anymore because they were just some, probably like a PhD project and no one really had the time or energy to maintain it after that person graduated. And the person graduated, got a job and doesn't really care that much anymore, potentially.
It's funny, actually, for years, I was just working in Jupyter, playing Jupyter on my computer. Maybe give people a quick summary of the differences so who don't know. Very good idea. So basically, Jupyter is, I suppose you could call it an editor. It's basically an interactive document, which you run against a Python kernel, or you can run it against different language kernels.
There are R, there are Julia, there are Kotlin notebooks. Should I give my little advertisement for JetBrains? Basically, what you can do is you can run code in cell blocks. Then you can also create markdown cells in between them. And this allows you to basically have, you know, markdown chunks and then cell chunks.
JupyterLab is hosted remotely. So you have basically a bunch of other functionality built in. So you can open terminals, you can create scripts, things like that. But basically, it's like a little Jupyter ecosystem, which is designed to be remotely hosted. And it can be accessed simultaneously by several people.
So I would say Jupyter is good if you are just starting out and you're dealing with small data sets. Maybe you're even retrieving things from databases, but you're not saving anything too heavy locally. You're not using a huge amount of memory, like maybe unless you got one of those new M2 Macs and server in your office.
But we've kind of tried or my teams have tried to solve some of these problems that you might have with just using plain Jupyter Notebooks or even working with JupyterLab, maybe a bit more like robustly. So we have actually three data science projects, products. We have PyCharm and Dataspel, which you've mentioned.
They're desktop IDEs with the ability to connect to remote machines, but they're not really collaborative, but they do give you like really like nice experience with using Jupyter, debugging and co-completion and all those sort of things. We have another one, which is DataLaw. And this falls into those managed notebooks that I was talking about.
It's cloud hosted. And the nice thing about DataLaw actually is you can do real-time collaboration. So it sort of helps overcome- Google Docs style, sort of. Yes, it's the same technology actually. So yeah, so it's kind of a very interesting thing because there will be times where, you know, maybe you're not working on a project with a data scientist, but you need them to have a look at your work.
Yeah, that's nice. Because sometimes a cell has to run for 30 minutes, but then it has this nice little answer and you can work with that afterwards, right? Exactly. Or you want a model to be available and maybe you haven't saved it or something like this is just a way around some of these friction points.
I want to circle back just really quickly for a sort of testimonial, I guess, out in the audience. Michael says, I started teaching basic Git, Docker and Python packaging to bioinformatics students at UCLA. And it's made a huge difference in the handoff. But I think for actual projects, you know, I just think as we were talking about what should people learn as data science and what they shouldn't.
Have you played with JupyterLite any? Only a teeny tiny bit because of this workshop that I'm going to be helping out with at EuroPython. So they're going to be running the whole thing in JupyterLite, hopefully. A couple of bugs to solve, but I think they're overcomable. But yeah, it's a really interesting alternative to Google Colab, actually.
Yeah. JupyterLite, take Pyodide, which is CPython running a WebAssembly, and then build a bunch of the data science libraries like Matplotlib and stuff in web WebAssembly. And then the benefit is you don't need a complex server to handle the compute and run arbitrary Python code, which is a little sketchy.
You just run it on the front end in WebAssembly, which is pretty cool. I interviewed the folks at PySport a little while ago. And it's just the ability to just take code and run all these different pieces on your front end without worrying about a server, I think is super cool. If I get that right or not.
But anyway, just I think running it on top of people using it on top of the browsers like you do JavaScript is it's an interesting thing to throw into the mix for notebooks. Actually, a lot of these projects coming out using Pyodide are really interesting. Obviously, PyScript is the big one from last year.
Yeah, I think PyScript actually has really lots of interesting possibilities beyond just the data science side, right? Whereas Pyodide is a little more focused on just, I think, really providing the data science tools on the client side. We'll see where PyScript goes. If they can make an equivalent of Vue.js or something like that, where people can start building legitimate front end interactive web apps like Airbnb or Google Maps or something.
But with Python, that's going to unlock something that has been locked away for a really long time. With Pyodide, that's like a nine or 10 meg download. That's too much for the front end, just for like a public facing site generally at the start of time. But they're moving it to MicroPython as an option.
Yeah, let's jump into Pandas, which is the other biggie when you're talking about data science. So what Pandas is really important for is it's basically the entry point of you working with your data. So it's a library, which basically allows you to work with data frames. Data frames are basically tables.
And from there, you can do data manipulation. You can explore your data and visualize it. And it also is an entry point to passing your data into models. Sometimes it'll need additional transformations. But say scikit-learn, which we can talk about in a sec, you can basically pass Pandas data frames directly into scikit-learn models.
I was kind of there when Dask was new and let's just say they find out a lot of the bugs. Yeah. So what ended up happening was I ended up learning PySpark instead. So I went down a different kind of route, but I think, you know, they solve very similar problems. It's just Dask is much more similar to Pandas.
And so you don't really need to deal with learning. It's similar, but it's a new API. Yeah. Another one that I was thinking of, I just had these guys on the show sort of is Ponder. Oh, I have not heard of this. So Ponder, they were at startup row at PyCon and they basically built on top of Moden, which is important, Moden.pandas as PD.
And what it does is it, instead of pulling all the data back and executing the commands on your machine in memory, which maybe that data transfer is huge. It actually runs it inside of Postgres and other data. And I think PySpark as well. Like it translates all these Pandas commands to SQL commands to run inside the database where the data is, which is also a pretty interesting thing.
It probably has support for some of the serialization formats for the back of the term, like, is it Parquet? And some of those types of things. I think that comes straight out of PyArrow. Yeah. Yeah. Excellent. So that kind of brings me to a trade-off I wanted to talk to you about before we get off of Pandas.
It doesn't try to be compatible. So you've got to learn it. So the question is, as a data scientist, as a data science team leader, how should you think about, you know, do we keep chasing the shiny new thing? Or do we stick with stuff that one, people know like Pandas, but two, also extends into this broader space as a gateway, as we described?
Like, what are your thoughts here? This is a super interesting question. So data scientists in some ways have the luxury of being able to maybe use newer packages faster. Because we build these small kind of atomic projects that we can just update to the next library that we feel like using in the next project.
You have less documentation and you have less entries on Stack Overflow. So I would say you need to make a tradeoff between the time you're not only going to spend learning it, but also debugging it because it's going to be slower. But your ChatGPT doesn't know much about Polis. Basically, you're essentially going to need to trade that off against, are you going to see a benefit from that?
So do you actually have problems with processing your data fast enough? If you're working on small data sets, probably not. If you're not, then maybe try something pandas or pandas adjacent. Yeah, that sort of community support side is important. And I'm pretty sure there are a lot of data scientists out there who are the one data scientist at their organization.
So, you know, 2017, 18, sort of the peak Python 2 versus 3 tension, I guess, maybe one year before then. I noticed that the data scientists were like, I don't know what y'all are arguing about. We're done with this. What we're arguing about is when can we take the Python 2 code out to absolutely 100% drop support for it, not when are we moving over?
Whereas people running, you know, that Django site that's been around for eight years that's still on Python 2, they're starting to get nervous because they don't want to rewrite it because it works. But they know they're going to have to. And I feel like, you know, we talked about the legacy code is sort of the success story that is dreaded of software on the computer science side.
Because that is less of a thing in data science, it's easier to go, well, this next project that we're starting in a couple of months, we can start with newer tools. Yep. And I actually remember the point where I decided, okay, this is the last project I'm doing into. Because the thing that was keeping me into was actually one of those libraries that I mentioned, which built by a university.
And I was like, you know what, I'm just going to go find some alternative tool. I think at that time, spaCy, which is a very well-known NLP library, actually, based here in Berlin, the company. Yeah, exactly. Basically a neighbor of yours. That's right. But I think spaCy was really getting off its feet in that time.
So Seaborn is a very popular one. We actually have an internal one called Let's Plot, which is a port of ggplot2. And there's another one called Plot9. And I think there actually may even be one called ggplot. Plotlib. Some of the fancy new ones that people hear about, they're actually internally just controlling matplotlib and a cleaner API, right?
Pretty much. And let me tell you, matplotlib needs a clean API. It's a bit, let's say, okay. Although give it some props for its XKCD graph style. I mean, that is pretty cool that you can get it to do that. I actually have done, I've done XKCD graphs in Python as well. It's a goal that you aim for to do like elite visualizations.
It's fun. And XKCD is amazing in a lot of ways. However, I think it also can serve an important role when you're presenting to like leaders of an organization, non-technical people. Because if they look and see a beautiful, pristine production ready, sort of like, we're done. Like, no, no, no, this is a product. No, we're done. Look, you already got it.
But if it comes out in sort of cartoony, kind of like wireframing for UI design, you're like, oh, there are no expectations it's done. It's XKCD. We're going to get you the real graphs later, right? Yeah, yeah. There may be some value there. Like a psychological effect where you make it look like a hand-drawn prototype.
Exactly. It looks just hand-drawn. It's barely done. That's right. It's really just theme equals. It didn't take me two days. scikit-learn, you mentioned that before. Yes. So there are a whole bunch of libraries for doing machine learning. scikit-learn is kind of your all-in-one for classic machine learning.
But then, you know, you have this whole other branch of data science, which is around neural nets or deep learning. So you have Keras, TensorFlow, you have PyTorch. And then you have a package for working with a lot of like these generative AI models or large language models called Transformers from a company called Hugging Face.
So all of these are actually super accessible. I wouldn't say TensorFlow and PyTorch can be tricky, but Keras is like a friendly front end for them. Actually, if anyone is interested in getting into this side of things, there's a book called Deep Learning in Python by an AI researcher at Google called Francois Cholet.
It is actually, I think, the most popular book ever on Manning. So it's an amazing book. I can only recommend it. And it's very gentle for beginners who have no background in the area. Okay. Yeah, cool. I'll put that in the show notes. Awesome. Yeah. All right. Well, there are many other things we can talk about.
Maybe just let's close this out with a quick shout out to your PyCon talk. Eventually, someday, I'm sure that the talks for PyCon will be on YouTube. They were last year, but I looked back and I was so excited near the end of the conference. I'm like, look, the talks are up. And I was talking to someone like, look, here's your talk.
So I decided to give this talk because I kind of had to learn things the hard way in terms of performance with Python. So basically, I used to do everything with loops. And then I had to start working with larger amounts of data. And it just doesn't scale. So over time, as I got better with Python, I learned more about NumPy, which is another important data science library.
And it basically allows you to do what's called vectorized operations. So in this talk, I basically talk about the math behind why vectorized operations work. You don't need any math background to understand. It's very gentle. And then just show why some of these operations work in NumPy and how you can implement it yourself to get really massive gains in performance speed.
Yeah, that's incredible. Move a lot of that stuff down into like a C or a Rust layer and just let it do its magic instead of looping in Python. Yeah. Exactly. Yeah. Very cool. So I don't know when, but eventually this will be out as a video. People can check out for me now. They know to go look for it.
Yeah, I think the poor team is still recovering so much work. I know. All right. Well, Jodi, it's been great to have you on the show. Before you get out of here, final two questions. If you're going to write some Python code, what editor are you using these days? So I'm actually using all three that I talked about.
And I really like them. Yeah, they are good. All right. And then notable PyPI package, something you want to give a shout out to, or if you prefer a Conda package, there's a lot of intersection there. I think my favorite package at the moment is Transformers. It is amazing. And the documentation that Hugging Face have put together is so good.
I had an absolute blast. Yeah, same. 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. The folks over at JetBrains encourage you to get work done with PyCharm. PyCharm Professional understands complex projects across multiple languages and technologies, so you can stay productive while you're writing Python code and other code like HTML or SQL.
Download your free trial at talkpython.fm/done with PyCharm. Spend better time with your data and build better ML-based applications. Use Prodigy from Explosion AI, a radically efficient data annotation tool. Get it at talkpython.fm/prodigy and use our code TALKPYTHON, all caps, to save 25% off a personal license.
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.
