Latest / Talk Python To Me / #422: How data scientists use Python
Transcript
- 0:00Regardless of which side of Python you sit on, software developer or data scientist,
- 0:04you surely know that data scientists and software devs seem to have different styles and priorities.
- 0:09Why is that? And what are the benefits as well as the pitfalls of this separation?
- 0:14That's the topic of this conversation with our guest, Dr. Jody Birchell,
- 0:19data science developer advocate at JetBrains.
- 0:21This is Talk Python in Me, episode 422, recorded May 31st, 2023.
- 0:27Welcome to Talk Python in Me, a weekly podcast on Python.
- 0:43This is your host, Michael Kennedy.
- 0:45Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython, both on fosstodon.org.
- 0:52Be careful with impersonating accounts on other instances, there are many.
- 0:56Keep up with the show and listen to over seven years of past episodes at talkpython.fm.
- 1:01We've started streaming most of our episodes live on YouTube.
- 1:05Subscribe to our YouTube channel over at talkpython.fm/youtube
- 1:09to get notified about upcoming shows and be part of that episode.
- 1:12This episode is brought to you by JetBrains, who encourage you to get work done with PyCharm.
- 1:19Download your free trial of PyCharm Professional at talkpython.fm/done-with-PyCharm.
- 1:26And it's brought to you by Prodigy from Explosion AI.
- 1:29Spend better time with your data and build better ML-based applications with Prodigy, a radically
- 1:35efficient data annotation tool.
- 1:37Get it at talkpython.fm/Prodigy and use our code TALKPYTHON, all caps, to save 25%
- 1:43off a personal license.
- 1:44Jodi, welcome to Talk Python in Me.
- 1:48Thank you.
- 1:48I am so thrilled to be on the show.
- 1:50I'm so thrilled to have you on the show.
- 1:52I've been a fan of your work for a while and we got a chance to get to know each other at
- 1:56this year's PyCon.
- 1:57And so here you are on the podcast as well.
- 2:00Thank you.
- 2:00We had some very nice Mexican food, actually, or maybe Utah Mexican.
- 2:05I don't know quite how I would interpret it.
- 2:07It was very good, though.
- 2:08It was very good.
- 2:10Yeah, the food was excellent.
- 2:11I thought the parties were great at the conference and people who are maybe still holding out on
- 2:18going.
- 2:18Personally, I really enjoyed being there.
- 2:20I think it's probably the best conference that I go to yearly.
- 2:24And it's like the vibe is so nice.
- 2:26On this show, we're going to talk about how data scientists use Python, which is somewhat
- 2:33different than maybe a software developer we have, which I guess I'll put myself solidly
- 2:38into that camp.
- 2:39I do a bunch of web development, make APIs, I build apps and ship them.
- 2:43That's quite a different story.
- 2:45And I think we're going to have a really great time talking about those things.
- 2:48But before we do, let's get a little bit.
- 2:51How did you get into programming, Python, data science?
- 2:54Yeah.
- 2:54So I'm probably going hand in hand with maybe not being a developer.
- 2:59My story is perhaps a little unconventional.
- 3:01So my background is academic, like a lot of data scientists.
- 3:05And unsurprisingly, the first language that I learned was R because I was doing psychology
- 3:10and health sciences and a lot of statistics.
- 3:13And I was procrastinating once during my PhD.
- 3:17You will find any excuse to not work on your thesis.
- 3:20And I think I was reading, oh, you know, people who are into statistics, you should really learn
- 3:25Python.
- 3:25It's the future.
- 3:26And I was like, I should learn Python.
- 3:28So I sat down and...
- 3:29Because I really don't want to write that next chapter.
- 3:32I just don't.
- 3:32Exactly.
- 3:32Exactly.
- 3:33So I remember it.
- 3:34Like I actually had this long weekend and I worked my way through, I think it was Zed Shaw's
- 3:40Learn Python the Hard Way.
- 3:41This is showing my age, I think.
- 3:43I loved it.
- 3:44Like I completed the course in three days and then I didn't know what to do with Python
- 3:49because the stats libraries weren't as developed back then.
- 3:51So I just put it aside for a couple of years and ended up picking it up again when I started
- 3:57working in industry because obviously I've left academia.
- 4:00And you sort of fairly quickly, once you start in data science, move away from more sort of
- 4:05statistical stuff to machine learning.
- 4:07And Python really has libraries for that.
- 4:09So that's my journey.
- 4:11It's a little bit bibs and bobs and stops and starts.
- 4:15But once I kind of picked up Python, it really was love at first sight.
- 4:18Oh, that's excellent.
- 4:19What's your PhD in?
- 4:20It's actually...
- 4:21Computer science, of course, right?
- 4:22Of course, of course.
- 4:24You know, it's so funny.
- 4:25You are the third person to ask me in two weeks and no one has asked me this question for like
- 4:29two years.
- 4:30My PhD was in hurt feelings.
- 4:32Hurt feelings?
- 4:33Yeah.
- 4:33Okay.
- 4:34I say this a little bit blithely.
- 4:35So my PhD being in psychology, I was really interested in emotions research and
- 4:41relationships research.
- 4:42So I kind of wanted to see what happens to people emotionally when close relationships
- 4:47go bad.
- 4:48And it's hurt feelings like things like, you know, infidelities, rejections, all of that.
- 4:55It's hurt.
- 4:55So I was just studying what generates like and regulates the intensity of hurt and studied
- 5:01that for four and a half years.
- 5:03Sounds interesting.
- 5:05I'm sure there was a lot of data to process.
- 5:07There was a lot of data to process and a lot of very interesting statistics.
- 5:12That was sort of how I got into data science.
- 5:15I fell in love with stats in undergrad and just kept going down that path.
- 5:18I think a lot of people are drawn to data science, not with the intent of waking up one
- 5:25day and saying, I'm going to be a data scientist, but they're excited or inspired about something
- 5:29tangential.
- 5:30And they're like, well, I really need to get something better than Excel to work on
- 5:34this.
- 5:35Absolutely.
- 5:36Yeah.
- 5:36Yeah.
- 5:37And we'll probably talk about this a little bit later about why data scientists use programming.
- 5:42And it kind of is like in some ways that need to jump from something way more powerful and
- 5:48reproducible than Excel.
- 5:49Yeah.
- 5:49Yeah.
- 5:50For sure.
- 5:50So how about now?
- 5:51You said you've left academics.
- 5:53And what are you doing these days?
- 5:56Yeah.
- 5:56So that leap from academia was a long time ago now.
- 5:59I think that was like seven years again, showing my age.
- 6:02So for six of those years, I was a data scientist.
- 6:06So day to day was, you know, pretty varied, but the job I have now is very different.
- 6:13So I currently work as a developer advocate at JetBrains.
- 6:16And the way I would describe my job is I'm a liaison between data scientists and JetBrains.
- 6:23So I try and advocate for our tools to be as good as they can be.
- 6:27And I try to recommend ways that people can use our tools if I think it's useful.
- 6:31But I'm definitely not marketing or sales.
- 6:33It's more if I think this is the right fit for you, I'll do it.
- 6:36So it's like the way I achieve that is really up to me.
- 6:41For me, I really kind of, I like to do a mixture of what I call internal and external
- 6:46activities.
- 6:47So external activities are actually kind of only tangentially related to the products.
- 6:52So this would be an example of an external activity.
- 6:54It's just getting out there and educating people about data science or educating data scientists
- 6:58about technical topics, things like conference talks or webinars, you know, all this sort of
- 7:05stuff.
- 7:05And then internal stuff is more focused on maybe things a bit more related to the product.
- 7:10So if I think there's a feature that people would be really interested in, I might make a
- 7:13video about it or create, you know, a blog post.
- 7:17So yeah, it's a real hodgepodge.
- 7:19So this week, for example, I've been working on actually a materials for a free workshop that
- 7:26they're organizing at EuroPython.
- 7:27So I'm going to be volunteering to help out that.
- 7:29It's completely unrelated to anything I'm doing at JetBrains.
- 7:32It's just a volunteer activity.
- 7:33But last week, I was at a conference, week before that.
- 7:36So you can see the job's pretty varied.
- 7:38Think developer evangelist.
- 7:40It seems like such a fun job.
- 7:42You know, I had your colleague, Paul Everitt on and we actually talked, it's quite a while
- 7:46ago, a couple of years ago, three, four.
- 7:48And we had a whole episode on like a panel on what is the developer advocate, developer
- 7:54relations job.
- 7:56But it's, it just seems like such a great mix of you still get to travel a little bit,
- 8:01see people, but you also get to write code and work on, on influencing technology and products
- 8:08and stuff.
- 8:08Yeah.
- 8:08And I think the thing that I started to appreciate about the job a few months in is you have a
- 8:13platform with this job and that means you can choose to promote the message that you want.
- 8:18And a message that no surprise is very meaningful for me is data science is for everyone.
- 8:24Like I hate the gatekeeping that can happen in tech communities.
- 8:28I think it's quite bad in terms of like people being intimidated by math in data science.
- 8:33And like, I'm here to say to you, if you want it, it's for you.
- 8:37It is a very cool field and yeah, it doesn't matter what background you come from.
- 8:41I absolutely agree.
- 8:42And I was kind of hinting at that saying like a lot of people who don't see themselves as
- 8:46developers or programmers, like still find really great places, really great fits in data
- 8:51science and in programming as well.
- 8:53And I also want to second that I don't think you really need that much math.
- 8:57Maybe if you're trying to build the next machine learning model platform, then yes.
- 9:03Okay.
- 9:03But that's not what most people do.
- 9:05They take the data, they clean it up.
- 9:07They do interesting visualizations and maybe put it into some framework for production.
- 9:11Right?
- 9:11Yeah.
- 9:12And the nice thing is the field is in such a point where you have so many frameworks or
- 9:17tools that will handle a lot of this stuff for you.
- 9:20Like I'm not saying you don't need any understanding of what's going on under the hood, but you can
- 9:24learn it incrementally.
- 9:26A lot of it is like with software development where you develop that smell or that instinct
- 9:30for when something is not right.
- 9:32That will benefit you more than, you know, knowing how backpropagation works from a calculus
- 9:38perspective.
- 9:39Like that stuff is maybe a bit too much.
- 9:41You don't necessarily need it.
- 9:42Yeah.
- 9:43Let's get into the main topic and talk a little bit about how does programming and Python differ
- 9:48on the data science side than say me as somebody who builds web apps.
- 9:52Yeah.
- 9:53And maybe we can start by doing an orientation to like, what does a data scientist do?
- 9:57Because I think this confuses a lot of people.
- 9:59Yeah.
- 9:59Yeah.
- 10:00So basically the role of a data scientist is to sort of like, like the reason you would
- 10:06hire a data scientist is you have a bunch of data and you have an instinct that you can
- 10:11use that data to either improve your internal processes or sell some sort of IP.
- 10:17So the reason, you know, we differ from BI analysts is BI analysts are doing analysis, but it's
- 10:24more about business as usual, which is really important.
- 10:27You absolutely need BI analysts.
- 10:29How are sales going?
- 10:30How much have we made versus last year?
- 10:32Like those kinds of charts, right?
- 10:34Like absolutely fundamental questions.
- 10:36So you need to be a analyst before you need a data scientist, but your data scientists are
- 10:40more there to push the envelope in a data driven way.
- 10:44So we have two main outputs.
- 10:47I would say you can either create an analysis and do a report, or you can build some sort of
- 10:53model that will go into production.
- 10:54So an example might be as a business, I have an instinct that I can get my customers to buy
- 11:01more things based on people like them also buying those things.
- 11:05So in that case, your data scientists might be able to build you a recommendation engine
- 11:10and this, you know, will have a business outcome.
- 11:13Developers obviously, on the other hand, have a very different goal.
- 11:16Their goal is to create robust software systems.
- 11:20So the concerns that they have are things like latency, server load, downtime, things like that.
- 11:27And it's very interesting.
- 11:29And we'll talk about it a bit more when we talk about code, if we kind of get into that
- 11:32topic, but basically data scientists are not really interested in creating code for the
- 11:38long term.
- 11:38Whereas the code becomes the product that software developers write often.
- 11:43And you have to think about things like legacy systems, because eventually every Greenfield
- 11:48project becomes a legacy system if it lasts for long enough.
- 11:51Yeah.
- 11:51If you're lucky, right?
- 11:52Because the alternative is it never really got used or it didn't add that much value and
- 11:56got discarded, shut down.
- 11:58All right.
- 11:59So even though people talk about how much they don't want legacy code or how they kind
- 12:03of, you know, don't necessarily want to work on it because they want to work on something
- 12:07new and shiny.
- 12:08That's kind of the success side of software development, right?
- 12:12Yeah, exactly.
- 12:13I do think it's super interesting to different life cycle of code on the data science side,
- 12:20because you might be just looking to explore a concept or understand an idea better and not
- 12:26necessarily ever intend to put it into production in the traditional software sense, right?
- 12:32So I've seen some pretty interesting code written that people would look at and go, oh my goodness,
- 12:40what is there's not even a function here?
- 12:43How is this possible?
- 12:44You know, it's like copy and paste, reuse almost.
- 12:46And yet it really does go from having no idea to pictures and understanding and then maybe
- 12:54handing that off potentially to be written more robustly or better.
- 12:58Exactly.
- 12:59And it's really interesting.
- 13:01Like they're kind of two very different processes.
- 13:04And that point actually where engineering and research meets is a very, very interesting one.
- 13:11And I've seen it work in multiple different ways in multiple different workplaces.
- 13:14So for example, I've worked in places where the data scientists were completely sequestered
- 13:20away from the engineers.
- 13:21And there really wouldn't be that much discussion between the engineers and the data scientists
- 13:25during the research phase, which I do not advise.
- 13:29So what that means is the data scientists will come at the end and hand over this chunk of
- 13:33perhaps very difficult to read code to an engineer and be like, hey, so we need to implement
- 13:39this.
- 13:40And the engineer is like, what is this?
- 13:41Okay.
- 13:42I will schedule that for the next six months.
- 13:44And then I've seen, you know, or I've been a data scientist embedded within a software
- 13:50development team.
- 13:51And in that case, your project is marching in lockstep with what the engineers are doing.
- 13:56And from the very start, you know, you've been discussing important things like you need
- 14:00to build a model that has latency constraints.
- 14:02You need to think about this as the data scientist in terms of like the model that you run,
- 14:07but also how it's implemented.
- 14:09Right.
- 14:09How much memory does it use?
- 14:10Because if you run it on your own machine by yourself, then, well, it's kind of the limit
- 14:14of your computer sort of sometimes.
- 14:15But if you're running a thousand of them concurrently because people are interacting at the website,
- 14:20all of a sudden that might make a difference.
- 14:22Exactly.
- 14:23Or like one of the most interesting problems I think I ever solved in my career was basically
- 14:28I was working at a job board.
- 14:29We're trying to improve the search using natural language processing.
- 14:34So we had this idea that we could build a model that found out the probabilistic relations between
- 14:40skills and job titles.
- 14:41So if someone typed a skill into the search, we could expand it with job titles and then
- 14:46find all of the jobs that we indexed with that at search time and vice versa with job titles
- 14:51and skills.
- 14:51The thing is we need to find those relations at search time.
- 14:55Like that is a very low latency system.
- 14:57And it was super interesting because we had to think about how we could search that vector
- 15:02space in really, really like quickly.
- 15:05Like instead of having to calculate the distance between that and every single vector, we had
- 15:10to work out how to do that more efficiently.
- 15:12That sort of stuff I really like because it's so applied and it's so like it's this really
- 15:17nice intersection between computer science and data science.
- 15:20I think it's super cool.
- 15:21That is neat.
- 15:22One of the things I really like about working with programming broadly is how concrete it is,
- 15:28right?
- 15:28You came from academics.
- 15:30You know, I was in grad school for a while as well.
- 15:33And it's, you could debate on and on about a certain idea or concept.
- 15:37And it's like, well, you might be right.
- 15:39Or I'm here and you push a button and you get the answer or it runs or like, there's a really
- 15:44nice feedback of like, I built this thing and it's look, it's really connecting these people.
- 15:49And, you know, then it comes down to, can you do it in real time and other things like
- 15:54that.
- 15:54But that's a really cool aspect of programming.
- 15:57This portion of Talk Python To Me is brought to you by
- 16:02JetBrains and PyCharm.
- 16:04Are you a data scientist or a web developer looking to take your projects to the next level?
- 16:09Well, I have the perfect tool for you, PyCharm.
- 16:11PyCharm is a powerful integrated development environment that empowers developers and data
- 16:17scientists like us to write clean and efficient code with ease.
- 16:21Whether you're analyzing complex data sets or building dynamic web applications, PyCharm has
- 16:26got you covered.
- 16:27With its intuitive interface and robust features, you can boost your productivity and bring your
- 16:32ideas to life faster than ever before.
- 16:34For data scientists, PyCharm offers seamless integration with popular libraries like NumPy,
- 16:39Pandas, and Matplotlib.
- 16:40You can explore, visualize, and manipulate data effortlessly, unlocking valuable insights with
- 16:46just a few lines of code.
- 16:48And for us web developers, PyCharm provides a rich set of tools to streamline your workflow.
- 16:52From intelligent code completion to advanced debugging capabilities, PyCharm helps you write clean, scalable
- 16:58code that powers stunning web applications.
- 17:01Plus, PyCharm's support for popular frameworks like Django, FastAPI, and React make it a breeze to build and deploy your web projects.
- 17:10It's time to say goodbye to tedious configuration and hello to rapid development.
- 17:14But wait, there's more.
- 17:16With PyCharm, you get even more advanced features like remote development, database integration, and version control, ensuring your projects stay organized and secure.
- 17:25So whether you're diving into data science or shaping the future of the web, PyCharm is your go-to tool.
- 17:30Join me and try PyCharm today.
- 17:32Just visit talkpython.fm/done-with-pycharm, links in your show notes, and experience the power of PyCharm firsthand for three months free.
- 17:43PyCharm.
- 17:44It's how I get work done.
- 17:49I think it's kind of a shame that a lot of places do set up their engineering and data science teams so separately.
- 17:56Sure, we have quite different roles and we have quite different backgrounds sometimes.
- 18:01But 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.
- 18:10When 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?
- 18:25Like the people doing React or Angular or Vue or whatever it is, you know, and the web design.
- 18:32Having those completely separated as well is also, you know, it's terrible.
- 18:36Not a good idea.
- 18:36It doesn't make any sense.
- 18:38And 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.
- 18:47But then I think having, I don't want to use the squad term because I know it's become a little bit unpopular to use it.
- 18:52But, you know, this idea of project-oriented teams, I think are quite important.
- 18:56Let's dive a little bit more into the research side of things that I want to ask you about.
- 19:00Why Python?
- 19:02Let's talk about how the research process works and maybe why that results in different priorities and styles of code and styles of engineering.
- 19:10It starts at a similar point to all software projects, which is business comes to you and they have some sort of goal.
- 19:17Sometimes it's very vague and you need to interpret that and turn it into an executable project.
- 19:23But where the sort of uncertainty starts and like where it sort of becomes a research project rather than a project.
- 19:31And 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.
- 19:46You might not understand the domain entirely, right?
- 19:48You're trying to gain understanding even.
- 19:50In 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.
- 19:56Again, something I've seen that you don't even know if the data exists to answer this question.
- 20:01So first is going and getting your data.
- 20:04And you spend quite a lot of time with the data because the data will be the one that tells you the story.
- 20:09It'll tell you whether what you even want is possible.
- 20:12And you probably like heard data scientists hammering on about, you know, garbage in, garbage out.
- 20:18Like you can build the most beautiful, sophisticated model you want.
- 20:21But if you have crap data where there's no signal, you're not going to get anything because it's just not there.
- 20:27Like the relationship you're looking for is not there.
- 20:30Yeah.
- 20:30The 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?
- 20:41Absolutely.
- 20:42And it's interesting because that data cleaning, data wrangling step also doesn't happen in one go, especially if you're building a model.
- 20:48So what will happen is you'll try something out and you'll be like, okay, it didn't quite work.
- 20:52Maybe I need to manipulate the data in a different way or I need to create this new variable.
- 20:56And then you'll go again.
- 20:58And it's this super iterative process where you have this tightly coupled relationship between both the models and the data.
- 21:06So it really is sort of, you know, how I was talking about the instinct.
- 21:09This is sort of where that comes in because you're going to spend like 80% of your time honing your skills.
- 21:14But it's the most, I think, valuable part of the process.
- 21:17And if the signal's there, you can usually get away with using really dumb and simple models.
- 21:23You know, things that are unfashionable now like decision trees or linear regression.
- 21:28You can get away with them because you've just got such good data that just go with a simpler model.
- 21:33It's got all the advantages.
- 21:35This 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.
- 21:42Estimation's always hard, right?
- 21:44What 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.
- 21:51And if not, you need to just keep having those discussions with the business stakeholders because otherwise they're going to not be very happy if you've spent six months just looking at something and you have nothing.
- 22:02Or what have you built?
- 22:03Well, I have some notebooks I could show you.
- 22:06I have 40,000 notebooks and they're all terrible.
- 22:09Yeah.
- 22:11Speaking of the data, Diego out in the audience has an interesting question.
- 22:15How big are the data sets businesses will bring to you typically?
- 22:17Enough that you don't need to go out and find more data.
- 22:20This is a good question.
- 22:21So I hate to be, it depends, you know.
- 22:25I get to say that though because, you know, I was a lead data scientist, so I earned that rank.
- 22:31It really does depend on the problem you need to solve.
- 22:33So typically business will have enough data to cover at least some of the use cases.
- 22:40So 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.
- 22:49So we had some that were a lot bigger like Germany or the UK.
- 22:53And we had some that were really small like Poland or Spain.
- 22:56And we wanted to build these multi-language models or models maybe for different languages.
- 23:02We played around with both.
- 23:03And I don't think we really had enough data to support the models in these smaller languages.
- 23:09So the models were just not as good quality because we didn't have enough data.
- 23:12But for the bigger languages, we did.
- 23:14And 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.
- 23:22So then it sort of became like, well, okay, maybe it's good enough that we improve the search on the most important ones.
- 23:27And for the smaller ones, we just wait until we accumulate more data.
- 23:31So yeah, most of the time I found that there's a way to make it work for at least part of the solution.
- 23:37And then sometimes, like in the case of my last job, we had something like 170 billion auctions per day.
- 23:44So we had so much data.
- 23:48We even had problems like processing it.
- 23:50So sometimes, you know.
- 23:52That's the other side of the story is when you've got too much and then how do you throw it away, right?
- 23:56I mean, you've got this auction story, like another one that comes to mind is the Large Hadron Collider.
- 24:02Oh, yes, yes.
- 24:04They'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?
- 24:18Yeah, and it's interesting because what you can end up in this within those situations is even then you can have underrepresented groups.
- 24:26So, for example, we had, we're working with advertisers and apps, you know, basically trading ads.
- 24:31And we ended up with some apps that were just so small that you were like, even with all this data, I really don't have enough to represent this particular combination in this country.
- 24:42Interesting.
- 24:43Very interesting.
- 24:44So, why Python?
- 24:46You know, you started out in R and, of course, any distraction from writing a PhD is a good distraction.
- 24:53But I do think there's been a really interesting sort of graph.
- 24:57Like, if people go and look at, what is it, Stack Overflow Insights.
- 25:02If you go look at Stack Overflow Insights, they had a really great graph that shows you the popularity of Python over time.
- 25:12And there's just this huge inflection point around 2012.
- 25:15And I feel like that's when a lot of the data science libraries really came around and took off.
- 25:21It seems like there was a big inflection at one point, but, you know, why?
- 25:25To be honest, I can talk about why I like Python from my background.
- 25:31I couldn't really tell you exactly what caused that takeoff.
- 25:34But, you know, apart from, you know, this idea that the libraries were maturing enough.
- 25:38But the thing is, looking even at current surveys, around 60% of data scientists do not have a software development or a software engineering background.
- 25:47So, for people like us, we don't really understand, like, it sounds terrible.
- 25:52We don't really understand basic constructs in how a programming language works.
- 25:56And that can actually mean that going to some sort of compiled language even can be quite a steep learning curve.
- 26:03Sure.
- 26:03Pointers to pointers, for example.
- 26:05Like, oh, no things.
- 26:07Yeah.
- 26:08Or having to deal with the fact that in Java, everything is a class.
- 26:12You're just like, what is this?
- 26:15But of course, you understand why if you have that background.
- 26:18But if you're trying to learn it yourself, you then have a lot of background you need to cover.
- 26:22But in Python and in R as well, you don't need to cover those things.
- 26:26It's super easy to prototype.
- 26:28It's super easy to script.
- 26:29The flexibility of Python is what makes it, I think, the perfect prototyping language.
- 26:34And that's essentially what you're doing.
- 26:36You're prototyping.
- 26:36So, we talked a little bit earlier about, like, why not just Excel?
- 26:41We didn't quite say that.
- 26:42But this was sort of what we were maybe getting at.
- 26:45And, yeah, we could do some of our work in Excel.
- 26:48I've tried this.
- 26:49And first, I can tell you Excel really starts to struggle when you have too many calculations going on under the hood.
- 26:56It gets very, very slow.
- 26:58But to be honest, it's sort of just cleaner to code this sort of logic.
- 27:02It's much more reproducible when you need to do this iterative sort of stuff.
- 27:06And it also means that you can use much more powerful tools.
- 27:10So, you can, say, use APIs that developers have made to process your data.
- 27:16You can use powerful data.
- 27:18Right?
- 27:18Like, I need live currency conversion data.
- 27:21Right?
- 27:22So much easier than in Excel.
- 27:24Yes, yes, yes, exactly.
- 27:25Like, you can, like, scrape data.
- 27:27Or you can, yeah, pull data in off an API.
- 27:30Or you can use powerful tools like Spark to process 170 billion auctions per day in order to reduce it down to something manageable.
- 27:41So, yeah, it just gives you a lot more power.
- 27:42But at the same time, why we use programming languages is just such a different focus.
- 27:50It's a bit overkill to use something like Java.
- 27:52I know some people do do natural language processing in Java.
- 27:54But that's more on the engineering side to build maintainable systems.
- 27:58One 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.
- 28:08And I suspect R as well with a really partial understanding of what Python is and what it does.
- 28:14Right?
- 28:14Like you pointed out, you don't even have to know what a class is or even really how to create a function.
- 28:19You just, I can put these six magical incantations in a file and then I can do way more than I otherwise could.
- 28:26Right?
- 28:27Then you learn one more.
- 28:28You make it better and better as you kind of gain experience.
- 28:30Pretty much.
- 28:31And this is where I started.
- 28:31Like, obviously, I learned what functions and classes were when I first started programming.
- 28:36But in the end, you will just, maybe it's not the best thing.
- 28:40And we can sort of maybe get into this.
- 28:42I 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?
- 28:50Like, how much would data scientists benefit from knowing more about computer science topics?
- 28:56Or software engineering topics maybe more to the point?
- 28:59And, you know, because like the thing is, every field has so much to learn.
- 29:03Don't even get started on what's happening with large language models at the moment.
- 29:06Like, it's just overwhelming.
- 29:07Should we take some of our precious time and learn software engineering concepts?
- 29:12I'm not sure.
- 29:12Like, I'm not sure if I have the answer to that.
- 29:16This portion of Talk Python Army is brought to you by Prodigy, a data annotation tool from Explosion AI.
- 29:22Prodigy is created by Ines Montani and her team at Explosion.
- 29:26And she's been doing machine learning and NLP for a long time.
- 29:30Ines is a friend and frequent guest on the show.
- 29:32And if you've listened to any of her episodes, you know that she knows her ML tools.
- 29:37So what is Prodigy?
- 29:38It's a modern, scriptable annotation tool for machine learning developers made by the team behind the popular NLP library, spaCy.
- 29:46You can easily and visually annotate and develop data for named entity recognition, text classification, span, categorization, computer vision, audio, video, and more,
- 29:57and put your model in the loop for even faster results.
- 30:00After collecting data, you can quickly train and export a custom spaCy model or download annotations to use it with any other library or framework.
- 30:09Prodigy is entirely scriptable in Python, of course, the language we all love.
- 30:13And it seamlessly integrates with your favorite libraries and tools.
- 30:16Plus, the new alpha version they just released also introduces a built-in support for large language models,
- 30:23such as OpenAI's GPT models, and new tools for dividing up your data between multiple annotators.
- 30:29Talk Python listeners get a massive discount on a lifetime license.
- 30:33You'll get 25% off using the discount code Talk Python, but don't wait too long.
- 30:38This offer does expire.
- 30:40Get Prodigy at talkpython.fm/Prodigy and use our code Talk Python, all caps, to save 25% off a personal license.
- 30:49This link is in your podcast player show notes.
- 30:52Thank you to Explosion AI for sponsoring the show.
- 30:55I think it really depends on what kind of data scientist you are.
- 31:02If what you are is someone doing research, as you described before,
- 31:06and you're like, is there a trend between the type of device that they use to buy their thing at our store
- 31:13and how much they're buying on the second, you know, how much are likely to come back?
- 31:17Like, if they're using an iPhone, do they tend to spend more than if they're using an Android?
- 31:22And is that a thing that we should consider?
- 31:24Or, you know, is there any, like that kind of exploration, which you can judge whether or not you should make that exploration.
- 31:31But just put that aside for a minute.
- 31:33That kind of stuff, like once you know that answer, maybe you don't need to run that code again.
- 31:38Maybe you don't care.
- 31:38You just want to kind of discover if there is a trend.
- 31:41And there, maybe you need to know software engineering techniques, but should you be writing unit tests for that?
- 31:46I'd say maybe not, honestly.
- 31:48On 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,
- 31:56then you're kind of in the realm of continuously running for many people over a long time.
- 32:02And I think that really is a different situation.
- 32:04I think this is where you actually move from data science to machine learning engineering.
- 32:08This term has a lot of different definitions.
- 32:11For me, I base my definition of ML engineers on the two people that I've worked with,
- 32:15who were like true full stack kind of people who could go from research and prototyping to deployment.
- 32:23And they were data scientists who really cared enough to actually learn how to do proper engineering,
- 32:30and they could actually deploy their own things.
- 32:32But then this leads to another one of my very favorite topics, which is who is responsible for apps in production?
- 32:39And here's the thing.
- 32:41So I think as good as your data scientist is going to be, or your ML engineer, let's say an ML engineer,
- 32:47let's say that they can actually deploy their own code.
- 32:49If they're then responsible for that code in production, that then eats up the time that they can be prototyping
- 32:56and researching new things for you.
- 32:58So the conclusion I've come to over time, and again, this is a matter of a debate.
- 33:02This is just my opinion.
- 33:04Basically, I think if your company is above any sort of level of size or complexity,
- 33:09in terms of the data products it has, I think you really do need dedicated data science and engineering teams.
- 33:16Because in the end, no matter how good your data scientist code is going to be,
- 33:20it needs to be implemented by the person who's going to maintain it.
- 33:23And maybe they're not the ones writing the code from scratch.
- 33:26Maybe they can adapt the data scientist code if it's good enough.
- 33:29But in the end, they need to be comfortable and familiar enough with that code to be like,
- 33:33yeah, if I get pinged at three in the morning, I'm okay knowing what to do with this code.
- 33:38Yeah, that's a good point.
- 33:40Yeah.
- 33:40So I think it's just easier to scale these teams in parallel rather than trying to hire this like
- 33:45wall in one person who can do everything.
- 33:47They're impossible to hire.
- 33:48Like I've only ever met two over the course of my career.
- 33:51And quickly, they become overwhelmed by having to maintain projects.
- 33:55Right.
- 33:55Is that the best use of their time?
- 33:57Yeah.
- 33:57And like, it's maybe it's not necessarily even if it's the best use of their time.
- 34:01It's more like, then who's going to do your research?
- 34:05Because now you've used up that resource on maintaining two or three projects.
- 34:09Right.
- 34:10Absolutely.
- 34:10Chris May has got an interesting question out here in the audience.
- 34:13This kind of turns us on its head a little bit.
- 34:15It says, development teams tend to work better when they focus on writing and refactoring code
- 34:19to make it testable and understandable.
- 34:21And we've talked a little bit about maybe stuff that data scientists shouldn't care about
- 34:26or whatever.
- 34:27So he has other ideas that are like good practices for data scientists and teams of them.
- 34:33This is actually a really great question.
- 34:35So basically, it's an interesting thing with data scientists that unlike software developers,
- 34:40we often tend to work alone on projects or maybe in very, very small teams, like maybe two
- 34:47or three people.
- 34:48And I think it's probably a hangover from the fact a lot of us are ex-academics.
- 34:53We're just used to having like, it's not great, but it's...
- 34:57A whiteboard, an office in the corner, and no one knows what you're doing.
- 35:01Exactly.
- 35:02And no one cares.
- 35:03That paper that three people read took me three years.
- 35:07So what I think has been neglected, you know, aside from learning software engineering best
- 35:13practices is more fundamental things, which is like writing maintainable code.
- 35:18And I don't mean maintainable in the sense of it's a system that needs to be able to run
- 35:23regularly.
- 35:23It's more like this is a piece of code that I can come back to in six months and understand
- 35:29what I was doing.
- 35:30Because, you know, research projects can be shelved forever, but maybe they need to
- 35:34be revisited and, you know, built upon.
- 35:37So this was actually a topic I got really interested when I first moved to industry, like this idea
- 35:43of reproducibility with data science projects.
- 35:45It's about the code, but it's also about things like dependency management, which is notoriously...
- 35:50Oh, yes.
- 35:51...difficult in Python to get reproducible environments later.
- 35:56And even the operating system, if Linux is really dramatically changed over time, then
- 36:01maybe your old dependency, you want to keep that one, but it won't run on the new operating
- 36:07system or there's a whole spectrum of challenges there.
- 36:09Exactly.
- 36:10Exactly.
- 36:11And it's sort of something that can be solved with using poetry, which is a little bit more
- 36:16robust.
- 36:17But even then, you've still got it.
- 36:19Like it runs on my machine effect where your machine will not be the same machine.
- 36:24Recently, there's actually a move towards doing more sort of cloud-based stuff for data
- 36:28science, which solves a few of these problems.
- 36:31And it also solves the additional problem where data scientists often need to do remote development
- 36:35for various reasons.
- 36:36Like you need access to GPUs in order to train models.
- 36:39So, you know, obviously if you have a server, you have a Docker container, which has, you know,
- 36:45environment specifications, you can power up that exact same environment.
- 36:48And that actually helps with that reproducibility a lot.
- 36:51And then another point, which I think is really important for data scientists and can be neglected
- 36:57is literate programming.
- 36:58So this is an idea from Donald Knuth.
- 37:00And it's this idea that, you know, you should write your code in such a way that it's actually
- 37:06understandable later.
- 37:07With data science work, it's also that you really need to document a lot of the implicit kind of
- 37:14assumptions that you make or decisions that you make as part of the research process.
- 37:18And this is one of the reasons, probably a good segue, why Jupyter is so important.
- 37:23Yeah.
- 37:23Jupyter notebooks are designed to be research documents.
- 37:26So this is why you have the markdown cells if you've seen a Jupyter notebook, because it's
- 37:31this idea that you really, really need to like document along with the code, the decisions
- 37:36that you made.
- 37:36Like, why did you choose this sample?
- 37:38Why did you decide to create the inputs to your models the way that you did it?
- 37:43You need to document all this stuff.
- 37:44So yeah, reproducibility is a super interesting topic.
- 37:47And I think it's, yeah, something that really needs to be thought about carefully, even if
- 37:53you're not collaborating with anyone else, because otherwise your piece of research is going to
- 37:57be worthless in three months because you're not going to remember what you did.
- 37:59I think notebooks are quite interesting.
- 38:01They go a long ways to solving that.
- 38:02When used in the right way, you can just jam a bunch of non-understandable stuff in there.
- 38:07And it's just, well, now it's not understandable, but it's in a web page instead of in an editor.
- 38:11But I think as in, you know, not just programmers, but tech in general, we're just bad at thinking
- 38:18about the long-term life cycle of information and compute.
- 38:24For example, I got a new heat pump to replace the furnace at my house.
- 38:29The manual for it came on a CD drive.
- 38:31And I'm like, I don't think I have a CD.
- 38:33Where did I put that?
- 38:34I went to go dig through closet full of electronics.
- 38:37I'm not sure I can read that, right?
- 38:39And, you know, CD seems so ubiquitous for so long, right?
- 38:43And just simple little mismatches like that just get worse over time.
- 38:48It's going to be tough to keep some of this older research and reproducibility around.
- 38:53Yeah.
- 38:54Like it's super interesting that there are packages I used to use, you know, back when I first
- 38:59started in natural language processing.
- 39:01Some of them haven't been updated from Python 2.
- 39:03So I can't use them anymore because they were just some, probably like a PhD project and
- 39:08no one really had the time or energy to maintain it after that person graduated.
- 39:12And the person graduated, got a job and doesn't really care that much anymore, potentially.
- 39:16Exactly.
- 39:16Not enough to keep it going.
- 39:17Yeah.
- 39:18It's not even necessarily their fault.
- 39:19It's just life.
- 39:20Yeah.
- 39:21Let's talk about some of the libraries and tools.
- 39:24You mentioned Jupyter.
- 39:25I think Jupyter is one of the absolute cornerstones, right?
- 39:29So Jupyter or JupyterLab, what are your thoughts here?
- 39:33It's funny, actually, for years, I was just working in Jupyter, playing Jupyter on my computer.
- 39:38Maybe give people a quick summary of the differences so who don't know.
- 39:42Very good idea.
- 39:43So basically, Jupyter is, I suppose you could call it an editor.
- 39:46It's basically an interactive document, which you run against a Python kernel, or you can
- 39:52run it against different language kernels.
- 39:53There are R, there are Julia, there are Kotlin notebooks.
- 39:56Should I give my little advertisement for JetBrains?
- 39:58Basically, what you can do is you can run code in cell blocks.
- 40:02Then you can also create markdown cells in between them.
- 40:05And this allows you to basically have, you know, markdown chunks and then cell chunks.
- 40:10JupyterLab is hosted remotely.
- 40:13So you have basically a bunch of other functionality built in.
- 40:16So you can open terminals, you can create scripts, things like that.
- 40:20But basically, it's like a little Jupyter ecosystem, which is designed to be remotely hosted.
- 40:25And it can be accessed simultaneously by several people.
- 40:28So I would say Jupyter is good if you are just starting out and you're dealing with small
- 40:35data sets.
- 40:36Maybe you're even retrieving things from databases, but you're not saving anything too heavy locally.
- 40:42You're not using a huge amount of memory, like maybe unless you got one of those new M2 Macs
- 40:46and server in your office.
- 40:48So go for it.
- 40:49Exactly.
- 40:49Yeah.
- 40:50JupyterLab, I think, is good if basically you need to access different types of machines.
- 40:56So maybe you need to be able to access GPU machines easily.
- 40:59You kind of want that remote first experience where you don't have to then connect to a remote
- 41:03machine.
- 41:04And I have found JupyterLab helpful in the past for sharing.
- 41:07But the thing you can't do with JupyterLab is real-time collaboration.
- 41:10And that's a bit of a pain in the butt.
- 41:12Obviously, since I started at JetBrains, I've kind of, you know, like I'm using our tools
- 41:17and I like them a lot.
- 41:18Obviously, I wouldn't advocate them.
- 41:20Yeah.
- 41:20I was going to ask, is this PyCharm, Dataspel, like when you actually do that, are you using
- 41:25some of those type of tools?
- 41:26I am.
- 41:27So I won't turn this into too much of an advertisement for our tools because it's not
- 41:31really the point of me being here.
- 41:32But we've kind of tried or my teams have tried to solve some of these problems that you might
- 41:39have with just using plain Jupyter Notebooks or even working with JupyterLab, maybe a bit
- 41:43more like robustly.
- 41:46So we have actually three data science projects, products.
- 41:49We have PyCharm and Dataspel, which you've mentioned.
- 41:52They're desktop IDEs with the ability to connect to remote machines, but they're not really
- 41:57collaborative, but they do give you like really like nice experience with using Jupyter, debugging
- 42:02and co-completion and all those sort of things.
- 42:05We have another one, which is DataLaw.
- 42:07And this falls into those managed notebooks that I was talking about.
- 42:10It's cloud hosted.
- 42:11And the nice thing about DataLaw actually is you can do real-time collaboration.
- 42:16So it sort of helps overcome-
- 42:18Google Docs style, sort of.
- 42:18Yes, it's the same technology actually.
- 42:20So yeah, so it's kind of a very interesting thing because there will be times where, you
- 42:27know, maybe you're not working on a project with a data scientist, but you need them to
- 42:31have a look at your work.
- 42:32And when I was working with JupyterLab, what we would do is we would clone the notebook to
- 42:37our own folder and then we were in the same environment.
- 42:40So it was okay.
- 42:41But then you would rerun the whole thing again.
- 42:43And sometimes it would be pretty time consuming.
- 42:46DataLaw is an alternative to that.
- 42:47It may or may not be kind of your style, but it's pretty cool because you can actually
- 42:53just invite someone to the same notebook instance that you're in and you're basically hosting
- 42:58them and they have access to everything that you've already run.
- 43:01So it's like true kind of real time.
- 43:04Yeah, that's nice.
- 43:04Because sometimes a cell has to run for 30 minutes, but then it has this nice little answer
- 43:09and you can work with that afterwards, right?
- 43:11Exactly.
- 43:11Or you want a model to be available and maybe you haven't saved it or something like this
- 43:17is just a way around some of these friction points.
- 43:19I want to circle back just really quickly for a sort of testimonial, I guess, out in the
- 43:23audience.
- 43:24Michael says, I started teaching basic Git, Docker and Python packaging to bioinformatics
- 43:29students at UCLA.
- 43:31And it's made a huge difference in the handoff.
- 43:33But I think for actual projects, you know, I just think as we were talking about what should
- 43:38people learn as data science and what they shouldn't.
- 43:40Yeah.
- 43:40A little bit of the fluency with some of these tools is really helpful.
- 43:44I absolutely agree.
- 43:45Like I know it can be really overwhelming, especially Git initially for students.
- 43:50Git is overwhelming.
- 43:51Yeah.
- 43:52At first.
- 43:52I would say I'm because I tend to work on things by myself.
- 43:57Yeah, yeah.
- 43:57This sort of falls into the reproducibility stuff that I was talking about earlier.
- 44:02And it's super, super important.
- 44:04Like and once you get comfortable with like just basic use of these tools, you can get really
- 44:08far.
- 44:09Okay.
- 44:09Back to some of the tools, Jupyter, JupyterLab.
- 44:12What about JupyterLite?
- 44:14Have you played with JupyterLite any?
- 44:16Only a teeny tiny bit because of this workshop that I'm going to be helping out with at EuroPython.
- 44:21So they're going to be running the whole thing in JupyterLite, hopefully.
- 44:24A couple of bugs to solve, but I think they're overcomable.
- 44:27But yeah, it's a really interesting alternative to Google Colab, actually.
- 44:33Yeah.
- 44:33JupyterLite, take Pyodide, which is CPython running a WebAssembly, and then build a bunch
- 44:40of the data science libraries like Matplotlib and stuff in web
- 44:44WebAssembly.
- 44:44And then the benefit is you don't need a complex server to handle the compute and run arbitrary
- 44:50Python code, which is a little sketchy.
- 44:52You just run it on the front end in WebAssembly, which is pretty cool.
- 44:55I interviewed the folks at PySport a little while ago.
- 44:58And 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.
- 45:08If I get that right or not.
- 45:09But 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.
- 45:20Actually, a lot of these projects coming out using Pyodide are really interesting.
- 45:24Obviously, PyScript is the big one from last year.
- 45:26Yeah, I think PyScript actually has really lots of interesting possibilities beyond just the data science side, right?
- 45:33Whereas Pyodide is a little more focused on just, I think, really providing the data science tools on the client side.
- 45:39We'll see where PyScript goes.
- 45:41If 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.
- 45:52But with Python, that's going to unlock something that has been locked away for a really long time.
- 45:57With Pyodide, that's like a nine or 10 meg download.
- 46:01That's too much for the front end, just for like a public facing site generally at the start of time.
- 46:06But they're moving it to MicroPython as an option.
- 46:09And that's a couple hundred K, which is like these other front end frameworks.
- 46:12So it's very exciting.
- 46:13I think that's going to be that's definitely the most exciting thing in that area.
- 46:17But all right, back to data science.
- 46:18Let's see.
- 46:19Where do you want to go next?
- 46:20You want to talk Pandas maybe?
- 46:21Yeah, let's jump into Pandas, which is the other biggie when you're talking about data science.
- 46:26So what Pandas is really important for is it's basically the entry point of you working with your data.
- 46:32So it's a library, which basically allows you to work with data frames.
- 46:37Data frames are basically tables.
- 46:39And from there, you can do data manipulation.
- 46:41You can explore your data and visualize it.
- 46:44And it also is an entry point to passing your data into models.
- 46:49Sometimes it'll need additional transformations.
- 46:51But say scikit-learn, which we can talk about in a sec, you can basically pass Pandas data frames directly into scikit-learn models.
- 46:59Pandas also, because of its popularity, has kind of opened up this easy access to like grid computing and other types of processing database stuff that you don't really need to learn those tools, but you get to take advantage of.
- 47:14And so two things that come to mind for me are Dask.
- 47:16Yes.
- 47:16It's kind of like a Pandas code, but instead you can actually run this across this cluster of machines or larger than memory or stuff on my personal computer or even just take advantage of all 10 cores on my M2 instead of the one.
- 47:34Yes.
- 47:35Have you done anything with Dask?
- 47:36Are you a fan of it?
- 47:37I was kind of there when Dask was new and let's just say they find out a lot of the bugs.
- 47:42Yeah.
- 47:43So what ended up happening was I ended up learning PySpark instead.
- 47:46So I went down a different kind of route, but I think, you know, they solve very similar problems.
- 47:52It's just Dask is much more similar to Pandas.
- 47:55And so you don't really need to deal with learning.
- 47:57It's similar, but it's a new API.
- 48:00Yeah.
- 48:00Another one that I was thinking of, I just had these guys on the show sort of is Ponder.
- 48:05Oh, I have not heard of this.
- 48:07So Ponder, they were at startup row at PyCon and they basically built on top of Moden, which is important, Moden.pandas as PD.
- 48:16And 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.
- 48:23It actually runs it inside of Postgres and other data.
- 48:26And I think PySpark as well.
- 48:28Like 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.
- 48:37That is amazing.
- 48:38So, yeah, it's just interpreting the code in a completely different way.
- 48:41You can do like query planning and optimize the code.
- 48:44Yeah, exactly.
- 48:44They said that df.describe is like 300 lines of SQL.
- 48:50It's really, really tough.
- 48:51But once this thing writes it, then it's good to go.
- 48:53And I think the reason I bring this up is like you don't have to write that code.
- 48:56You just have to know Pandas.
- 48:58And then all of a sudden there's these libraries that will do either grid computing or really complex SQL queries that you don't care about.
- 49:04Yes.
- 49:05You don't care to write or so on.
- 49:06So I think it's Pandas is interesting on its own, but it's almost like a gateway to the broader data science community.
- 49:12Agreed.
- 49:12Agreed.
- 49:13And it's such a de facto, I think, for data analysis now or data manipulation transformation.
- 49:20Yeah, like I don't see it going away anytime soon.
- 49:23And actually, Pandas 2.0 just came out.
- 49:26And instead of being, yeah, instead of Pandas is NumPy under the hood, which is fast, but it's not really equipped to deal with certain kinds of structures like strings.
- 49:38Because, you know, it's not really what NumPy is about.
- 49:41And also missing values.
- 49:42The way that it handles it is pretty janky.
- 49:45So, yeah, it's been rewritten with PyArrow under the hood.
- 49:48Right.
- 49:48Yeah.
- 49:48Apparently, the performance is so much better.
- 49:51Something I need to sit down and actually try.
- 49:54It's been out for like a month and I'm feeling a bit bad.
- 49:57But, yeah.
- 49:57Yeah, that's cool.
- 49:58It probably has support for some of the serialization formats for the back of the term, like, is it Parquet?
- 50:04And some of those types of things.
- 50:06I think that comes straight out of PyArrow.
- 50:08Yeah.
- 50:09Yeah.
- 50:09Excellent.
- 50:09So that kind of brings me to a trade-off I wanted to talk to you about before we get off of Pandas.
- 50:14Although it sounds like Pandas 2.0, it makes this less important.
- 50:18But, you know, another sort of competitor that came out is Polars, which is a data frame library for Python written in Rust.
- 50:26Many of the things are written in Rust these days when they care about performance.
- 50:30It's like a big trend.
- 50:31It's the new C extensions of Python.
- 50:33But this one is supposed to also be way faster than Pandas 1.
- 50:37And I think it's also based on PyArrow, amongst other things.
- 50:41The details are not super important.
- 50:43But more what I wanted to ask you is like, well, here's another way.
- 50:45This is a totally different API.
- 50:47It doesn't try to be compatible.
- 50:48So you've got to learn it.
- 50:49So 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?
- 50:59Or 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?
- 51:07Like, what are your thoughts here?
- 51:08This is a super interesting question.
- 51:10So data scientists in some ways have the luxury of being able to maybe use newer packages faster.
- 51:18Because 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.
- 51:27And maybe we're the only ones who ever look at that code.
- 51:29So it's cool.
- 51:29The problem is, though, of course, is if someone else needs to look at your code, they are going to need to be able to read it, which is not maybe the biggest problem.
- 51:39The biggest problem, of course, is any new library.
- 51:43You have less documentation and you have less entries on Stack Overflow.
- 51:47So 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.
- 51:54But your ChatGPT doesn't know much about Polis.
- 51:57Basically, you're essentially going to need to trade that off against, are you going to see a benefit from that?
- 52:03So do you actually have problems with processing your data fast enough?
- 52:09If you're working on small data sets, probably not.
- 52:10If you're not, then maybe try something pandas or pandas adjacent.
- 52:14Yeah, that sort of community support side is important.
- 52:18And I'm pretty sure there are a lot of data scientists out there who are the one data scientist at their organization.
- 52:25And so it's not like, oh, we'll go ask the other expert down the hall because if it's not you, there's no answer, right?
- 52:31Exactly.
- 52:31I do think, though, like it's good to be curious.
- 52:34It's good to try out new things as well.
- 52:37And again, part of being a data scientist is you can experiment a bit more.
- 52:41So, you know, 2017, 18, sort of the peak Python 2 versus 3 tension, I guess, maybe one year before then.
- 52:51I noticed that the data scientists were like, I don't know what y'all are arguing about.
- 52:55We're done with this.
- 52:56What 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?
- 53:04Whereas 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.
- 53:13But they know they're going to have to.
- 53:14And 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.
- 53:23Because 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.
- 53:31Yep. And I actually remember the point where I decided, okay, this is the last project I'm doing into.
- 53:36Because the thing that was keeping me into was actually one of those libraries that I mentioned, which built by a university.
- 53:45And I was like, you know what, I'm just going to go find some alternative tool.
- 53:48I think at that time, spaCy, which is a very well-known NLP library, actually, based here in Berlin, the company.
- 53:56Yeah, exactly. Basically a neighbor of yours.
- 53:58That's right. But I think spaCy was really getting off its feet in that time.
- 54:03So I was like, you know, I'm just going to switch over to this new library and try that.
- 54:06And it's excellent. So I didn't look back.
- 54:09Yeah. spaCy's cool. Ines Montani is doing really great work.
- 54:13And everyone over at Explosion AI.
- 54:14And that's the thing. Sometimes it seems like a hassle, right?
- 54:18But if it forces you out of your comfort zone to pick stuff that's being actively developed, maybe it's worth it, right?
- 54:23Exactly.
- 54:24All right. We're getting short on time. So you want to give us a lightning round and the other important libraries you think data scientists should pay attention to?
- 54:31Yeah. So let's just quickly go through the visualization side of things.
- 54:35So visualization is massive.
- 54:37So matplotlib is really the biggie.
- 54:40And it's what a lot of libraries are actually built on top of in Python.
- 54:44So the syntax is not that friendly. So there's a lot of alternatives.
- 54:48So Seaborn is a very popular one.
- 54:51We actually have an internal one called Let's Plot, which is a port of ggplot2.
- 54:56And there's another one called Plot9. And I think there actually may even be one called ggplot.
- 54:59Plotlib.
- 55:00Some of the fancy new ones that people hear about, they're actually internally just controlling matplotlib and a cleaner API, right?
- 55:06Pretty much. And let me tell you, matplotlib needs a clean API. It's a bit, let's say, okay.
- 55:13Although give it some props for its XKCD graph style.
- 55:17I mean, that is pretty cool that you can get it to do that.
- 55:21I actually have done, I've done XKCD graphs in Python as well.
- 55:27It's a goal that you aim for to do like elite visualizations.
- 55:31It's fun. And XKCD is amazing in a lot of ways.
- 55:35However, I think it also can serve an important role when you're presenting to like leaders of an organization, non-technical people.
- 55:44Because if they look and see a beautiful, pristine production ready, sort of like, we're done.
- 55:50Like, no, no, no, this is a product. No, we're done. Look, you already got it.
- 55:53But 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.
- 56:01It's XKCD. We're going to get you the real graphs later, right?
- 56:03Yeah, yeah.
- 56:04There may be some value there.
- 56:05Like a psychological effect where you make it look like a hand-drawn prototype.
- 56:10Exactly. It looks just hand-drawn. It's barely done.
- 56:12That's right.
- 56:13It's really just theme equals.
- 56:14It didn't take me two days.
- 56:15scikit-learn, you mentioned that before.
- 56:19Yes. So there are a whole bunch of libraries for doing machine learning.
- 56:24scikit-learn is kind of your all-in-one for classic machine learning.
- 56:27But then, you know, you have this whole other branch of data science, which is around neural nets or deep learning.
- 56:33So you have Keras, TensorFlow, you have PyTorch.
- 56:39And 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.
- 56:50So all of these are actually super accessible.
- 56:53I wouldn't say TensorFlow and PyTorch can be tricky, but Keras is like a friendly front end for them.
- 56:57Actually, 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.
- 57:08It is actually, I think, the most popular book ever on Manning.
- 57:13So it's an amazing book.
- 57:15I can only recommend it.
- 57:17And it's very gentle for beginners who have no background in the area.
- 57:20Okay. Yeah, cool.
- 57:22I'll put that in the show notes.
- 57:23Awesome.
- 57:23Yeah.
- 57:24All right.
- 57:25Well, there are many other things we can talk about.
- 57:28Maybe just let's close this out with a quick shout out to your PyCon talk.
- 57:34Eventually, someday, I'm sure that the talks for PyCon will be on YouTube.
- 57:40They were last year, but I looked back and I was so excited near the end of the conference.
- 57:45I'm like, look, the talks are up.
- 57:46And I was talking to someone like, look, here's your talk.
- 57:49They're like, no, that's my talk from last year.
- 57:50I'm like, oh.
- 57:51Yeah.
- 57:52So it was maybe three or four months delayed until it actually came out.
- 57:56So maybe this midsummer or the video Virginia talk will be out.
- 58:00But maybe just give people a quick elevator pitch of your talk here.
- 58:03Yeah.
- 58:04So I decided to give this talk because I kind of had to learn things the hard way in terms
- 58:10of performance with Python.
- 58:11So basically, I used to do everything with loops.
- 58:15And then I had to start working with larger amounts of data.
- 58:18And it just doesn't scale.
- 58:19So over time, as I got better with Python, I learned more about NumPy, which is another
- 58:25important data science library.
- 58:26And it basically allows you to do what's called vectorized operations.
- 58:30So in this talk, I basically talk about the math behind why vectorized operations work.
- 58:36You don't need any math background to understand.
- 58:38It's very gentle.
- 58:39And then just show why some of these operations work in NumPy and how you can implement it yourself
- 58:46to get really massive gains in performance speed.
- 58:50Yeah, that's incredible.
- 58:51Move a lot of that stuff down into like a C or a Rust layer and just let it do its magic
- 58:56instead of looping in Python.
- 58:58Yeah.
- 58:58Exactly.
- 58:59Yeah.
- 59:00Very cool.
- 59:00So I don't know when, but eventually this will be out as a video.
- 59:03People can check out for me now.
- 59:06They know to go look for it.
- 59:07Yeah, I think the poor team is still recovering so much work.
- 59:10I know.
- 59:11All right.
- 59:12Well, Jodi, it's been great to have you on the show.
- 59:15Before you get out of here, final two questions.
- 59:17If you're going to write some Python code, what editor are you using these days?
- 59:20So I'm actually using all three that I talked about.
- 59:23I use PyCharm if I need to do something like a bit more on the engineering side, which is
- 59:29not that often for me.
- 59:30DataSpell if I'm doing sort of very local development and doing more of the research side.
- 59:35And then if I need some GPUs, I'm using DataLaw.
- 59:39So a bit boring, but using all of our tools.
- 59:42And I really like them.
- 59:43Yeah, they are good.
- 59:45All right.
- 59:45And then notable PyPI package, something you want to give a shout out to, or if you prefer
- 59:51a Conda package, there's a lot of intersection there.
- 59:54I think my favorite package at the moment is Transformers.
- 59:56It is amazing.
- 59:58And the documentation that Hugging Face have put together is so good.
- 1:00:01And just the work they're doing in open data science is so, so important.
- 1:00:05So like big props to Hugging Face.
- 1:00:08We should really support the work that they're doing.
- 1:00:10Excellent.
- 1:00:10All right.
- 1:00:11Well, thanks for being on the show and sharing your experience.
- 1:00:15Thank you so much for having me.
- 1:00:16I had an absolute blast.
- 1:00:17Yeah, same.
- 1:00:18Bye.
- 1:00:18Bye.
- 1:00:19This has been another episode of Talk Python To Me.
- 1:00:22Thank you to our sponsors.
- 1:00:24Be sure to check out what they're offering.
- 1:00:26It really helps support the show.
- 1:00:27The folks over at JetBrains encourage you to get work done with PyCharm.
- 1:00:32PyCharm Professional understands complex projects across multiple languages and technologies,
- 1:00:38so you can stay productive while you're writing Python code and other code like HTML or SQL.
- 1:00:43Download your free trial at talkpython.fm/done with PyCharm.
- 1:00:48Spend better time with your data and build better ML-based applications.
- 1:00:53Use Prodigy from Explosion AI, a radically efficient data annotation tool.
- 1:00:57Get it at talkpython.fm/prodigy and use our code TALKPYTHON, all caps, to save 25% off a personal license.
- 1:01:06Want to level up your Python?
- 1:01:07We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:01:11Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:01:16And best of all, there's not a subscription in sight.
- 1:01:19Check it out for yourself at training.talkpython.fm.
- 1:01:22Be sure to subscribe to the show, open your favorite podcast app, and search for Python.
- 1:01:26We should be right at the top.
- 1:01:28You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct RSS feed at /rss on talkpython.fm.
- 1:01:37We're live streaming most of our recordings these days.
- 1:01:40If 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/youtube.
- 1:01:48This is your host, Michael Kennedy.
- 1:01:50Thanks so much for listening.
- 1:01:51I really appreciate it.
- 1:01:53Now get out there and write some Python code.
- 1:01:54I'll see you next time.