Latest / Talk Python To Me / #492: Great Tables
Transcript
- 0:00Join me as I chat with Rich Annone and Michael Chow from Posit, where we explore the transformative
- 0:05power of data tables with the Great Tables Library.
- 0:08We'll cover practical applications of great tables, showcasing how thoughtful design and
- 0:13advanced formatting can elevate your data presentations.
- 0:16And you'll learn about innovative features like nanoplots and interactive elements, as
- 0:21well as the importance of structure, format, and style in crafting tables that inspire.
- 0:26Whether you're a seasoned data scientist or just starting out, this episode is packed
- 0:30with valuable tips and inspiring examples to enhance your data storytelling.
- 0:34This is Talk Python To Me, recorded December 19th, 2024.
- 0:38Are you ready for your host, David?
- 0:41You're listening to Michael Kennedy on Talk Python To Me.
- 0:44Live from Portland, Oregon, and this segment was made with Python.
- 0:48Welcome to Talk Python To Me, a weekly podcast on Python.
- 0:54This is your host, Michael Kennedy.
- 0:56Follow me on Mastodon, where I'm @mkennedy, and follow the podcast using @talkpython,
- 1:01both accounts over at fosstodon.org.
- 1:05And keep up with the show and listen to over nine years of episodes at talkpython.fm.
- 1:09If you want to be part of our live episodes, you can find the live streams over on YouTube.
- 1:14Subscribe to our YouTube channel over at talkpython.fm/youtube and get notified about upcoming
- 1:20shows.
- 1:20This episode is sponsored by Posit Connect from the makers of Shiny.
- 1:24Publish, share, and deploy all of your data projects that you're creating using Python.
- 1:29Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quattro, Reports, Dashboards, and APIs.
- 1:35Posit Connect supports all of them.
- 1:38Try Posit Connect for free by going to talkpython.fm/posit.
- 1:42P-O-S-I-T.
- 1:43And it's also brought to you by us over at Talk Python Training.
- 1:48Did you know that we have over 250 hours of Python courses?
- 1:52Yeah, that's right.
- 1:54Check them out at talkpython.fm/courses.
- 1:56Hey, everyone.
- 1:58Two quick announcements before we dive into great tables.
- 2:00First, thanks for all your patience.
- 2:01It's been a few weeks since my last episode release.
- 2:04What I thought was going to be a brief winter break, pause, turned out to be longer.
- 2:08I had to slow my work down recently to help my dad with some health issues.
- 2:12We're getting that sorted and things are back on track with regard to the episodes.
- 2:15I have six already recorded and in the queue.
- 2:18Now, for some awesome news.
- 2:20I have a new feature I know you're going to love for the podcast episodes.
- 2:24I named it Deep Dives.
- 2:25I sent an email out about this early January.
- 2:28And if you're not part of the newsletter, you should be.
- 2:30The idea is to add way more reference material and backstory information to each episode page
- 2:36so that when you come back, you can skim through the content, pulling out important quotes,
- 2:41important topics, and extra detail.
- 2:43For example, on the episode I did with Carson Gross about HTMX, the deep dive starts out
- 2:48with a section called what to know if you're new to Python to help you get the most out of
- 2:53that specific episode.
- 2:54Then it features incremental adoption and complexity budgets, HTML fragments and partial updates,
- 3:00minimal JavaScript for React-like UIs, and even interesting quotes such as,
- 3:06your application has a complexity budget.
- 3:08Spend it efficiently by Carson.
- 3:11These do not appear in your podcast player, but if you visit any episode page for episodes
- 3:15that are published after October 2020, you'll find a deep dive for that show.
- 3:20Now, this does not replace the links section, which still exists on the episode page and in
- 3:25your podcast players.
- 3:26I think it adds a ton of value.
- 3:28I actually did a long write-up on this over at the Talk Python blog at talkpython.fm/blog.
- 3:34Creative, I know.
- 3:35So please give it a read if you want to know more.
- 3:37And there's an Easter egg there as well.
- 3:39There's an awesome notebook LM AI mind-blowing audio track I put in the middle that you should
- 3:46check out if you're interested in that kind of thing.
- 3:48It's really, really interesting.
- 3:50Well done.
- 3:51And we live in crazy times.
- 3:52Let's just leave it there.
- 3:53Check it out on the blog.
- 3:54So with that, thank you.
- 3:56Thank you for all the support.
- 3:57And let's dive into great tables.
- 3:59It's an awesome episode.
- 4:00Rich, Michael, welcome to Talk Python To Me.
- 4:04Great to have you two here.
- 4:05Hey, thanks for having us.
- 4:06Great to be here.
- 4:07It's a pretty interesting topic, these tables.
- 4:10You know, when I first heard about it, I was like, I was like, I, you know, it sounds
- 4:14interesting, but how are we going to talk about tables on the podcast?
- 4:17And you know, how, how much is it really to talk about with tables?
- 4:20Turns out there's a lot.
- 4:22And we're going to find a way to talk about it on the podcast.
- 4:24So it's, it's a pretty deep topic.
- 4:26There's so much.
- 4:27You don't need two hours.
- 4:28And honestly, like what you said just now is like story of my life for the past year of
- 4:33like being like, what, what could tables do?
- 4:36Like, yeah.
- 4:37And then just being freaked out.
- 4:38I mean, df.head, doesn't it?
- 4:39I just solve it.
- 4:40Come on.
- 4:40Right.
- 4:41We already got that.
- 4:41We already live.
- 4:42It's already so perfect.
- 4:44How could we improve on that?
- 4:45But yeah, I'm really excited.
- 4:47Cause this is, this is me kind of like fanning over rich, but like, I think it's like the
- 4:51perfect way to frame it.
- 4:52Like what's up with tables.
- 4:53I feel like having pulled that thread for the last year, I'm always excited to talk about
- 4:58these things here because like, I don't even be able to recapture how freaked out I am by
- 5:03whatever I just experienced for the past year with tables that we're just shipping away at
- 5:08is really exciting.
- 5:09Tables.
- 5:12So you know what I would say probably my impression, which I will grant you is a pretty
- 5:17fresh take on this.
- 5:18It's a little bit like, oh, well, we already got Excel.
- 5:20You can draw graphs with Excel or Altair, Plotly, those types of, you know, it's like, oh, wait,
- 5:26there's, there's actually a lot more we could do.
- 5:28That's pretty awesome.
- 5:28Yeah.
- 5:29We have a language too.
- 5:30I feel like having discovered there's a whole vocabulary for tables, I feel like was really
- 5:35enlightening.
- 5:37Yeah.
- 5:37I would think so.
- 5:38There's, there's almost like design patterns of tables or to get into that and like structure
- 5:43and some history and many things.
- 5:45But as per usual, before we jump into that, let's get a little bit of background on you
- 5:50guys and, you know, maybe quick introduction on the two of you, how you got motivated to
- 5:54get into work with great tables and that sort of thing.
- 5:56Yeah.
- 5:57Rich, you want to?
- 5:58Yeah.
- 5:58So I'm rich.
- 5:59How do you get into tables?
- 6:01I mean, I had to make tons of them.
- 6:03So that was sort of a necessity.
- 6:06So the problem was it was annoying to do like really annoying either doing it word was
- 6:11repetitive, you know, not reproducible, which kind of annoying me.
- 6:14I had to redo tables all the time because we had to use a tool that was outside of like
- 6:19programming.
- 6:20Right.
- 6:20That was like a major problem.
- 6:22Actually had to retranscribe them.
- 6:24There was many of them.
- 6:25It was kind of blah.
- 6:26So.
- 6:27Right.
- 6:27I swear.
- 6:27I swear.
- 6:28Like kind of like I opened with you could, you could automate the graphs, but you couldn't
- 6:34automate the tables.
- 6:34Right.
- 6:35Exactly.
- 6:36Yes.
- 6:36It was like the one last thing.
- 6:38So that was like where I came from with tables.
- 6:40And years later, I finally got to it.
- 6:43I mean, better late than never.
- 6:44Yeah.
- 6:45Yeah.
- 6:45I came in mostly to support rich.
- 6:48So a lot of what I've done is work is like a data scientist in R and Python.
- 6:54And I've, I've always kind of had a split and kind of split brain.
- 6:58So doing a lot of data analysis in R and more engineering tasks in Python.
- 7:03But I think as, as I noticed, Rich was kind of bringing this table idea to Python, I talked
- 7:10with him a bit and then I peeked through the code he was working on.
- 7:13And I was sort of really intrigued by how much was there.
- 7:16Like, I would say the first thing that really kind of surprised me is just how much code he
- 7:23had was just more than I kind of thought tables would need.
- 7:27And so this is more than one's file.
- 7:30I mean, come on.
- 7:31Don't we just put out a header and put out the rows?
- 7:33It was kind of like, there's a lot going on here for people who are not familiar with this.
- 7:36Yeah.
- 7:37Right.
- 7:37I surprised myself too with how much I wrote.
- 7:40I mean, it just kept snowballing the amount of things that had to be done.
- 7:43Yeah.
- 7:44I'm sure.
- 7:45And we did, we both came from academics.
- 7:48So we both did PhDs and I think we both produced like a decent number of tables as we did that.
- 7:55But yeah, never, never quite dove as deep into them or as intricate.
- 8:01Yeah.
- 8:01And probably most of the time, you know, you're knocking out something in Excel or LaTeX or
- 8:05something like that.
- 8:06Yeah.
- 8:07Once it's done, it's kind of done.
- 8:08It's not, not live in the sense like every day I want a new popular view of the status or,
- 8:14you know, whatever, like the dashboard sort of deal.
- 8:16What were your PhDs in?
- 8:17I did a chemistry of all things.
- 8:19Chemistry.
- 8:20I love chemistry.
- 8:21Yeah.
- 8:21A lot of tables.
- 8:22Again, a chemistry was one of my favorite courses I ever took.
- 8:24I love the two.
- 8:25Yeah.
- 8:25Organic was great.
- 8:26Yeah.
- 8:26Beautiful.
- 8:27Yeah.
- 8:27And I know, I know very little about chemistry.
- 8:30I did cognitive psychology.
- 8:32So.
- 8:32Okay.
- 8:33Tables in the mind or something.
- 8:35I don't know.
- 8:35Something like that.
- 8:37Yeah, absolutely.
- 8:38That's cool.
- 8:39So you must have had a lot of experience with trying to present your research and your thesis
- 8:45and stuff through, through tables, right?
- 8:47Yeah.
- 8:47Big time.
- 8:48I think it counted like something like 100 tables, including that the raw data section.
- 8:52So yeah, no shortage of tables there.
- 8:54And a lot of it came up in presentations and stuff.
- 8:57Had to remake them.
- 8:58Again, no, no good tool.
- 8:59So I was like, I felt like, I felt sad, but I had no time to like pursue a tool.
- 9:04So I just kept going.
- 9:06Yeah.
- 9:06I will say, I kind of picked up too, as I started working with Rich, that he's a supreme
- 9:11dabbler.
- 9:12Like he has collected tables from across the world in a lot of different domains.
- 9:18So that's, that's one thing that caught me too, was like, I don't doubt he produced a
- 9:22lot of chemistry tables, but I was amazed that I felt like he was like a guy in an alleyway
- 9:27trying to like sell me tables.
- 9:29Like, oh, you like a sports table?
- 9:32He's like, oh, you like basketball?
- 9:34You know, you like.
- 9:35Yeah.
- 9:36Yeah.
- 9:36The first, the first brackets free and then.
- 9:39Yeah.
- 9:39Yeah.
- 9:40Yeah.
- 9:40That's how it gets your hooks.
- 9:42Yeah.
- 9:42It kind of is like that.
- 9:43Yeah.
- 9:44Try to make tables possible for everybody, you know?
- 9:46Yeah.
- 9:47So how do we kick this off?
- 9:48We got to, I just want to say to all the listeners who are not watching the YouTube live stream,
- 9:53but are just listening, like most listen to the show do.
- 9:56We're going to do our best to describe some of these things.
- 9:59Some of them are visual, but I think we can pretty much capture the essence of them.
- 10:03I will try to set up chapters and put some chapter, chapter art.
- 10:09So keep an eye on your podcast player or your CarPlay view of now playing or whatever it is
- 10:14that's playing the thing.
- 10:15It might show, show some pictures.
- 10:17We'll see what we can do with that.
- 10:19But let's start off the conversation here, not on great tables exactly, but maybe just
- 10:24some examples of some good, good tables to give people a sense of just, you know, what
- 10:29more could you possibly do than just, you know, data frame dot header, something to that effect.
- 10:34You know what I mean?
- 10:35So I think it was Rich who sent this over.
- 10:38Yeah.
- 10:39What do you guys said?
- 10:39A visualization gallery.
- 10:41Yes.
- 10:42From Andrew Weatherman.
- 10:43And includes tables.
- 10:44It has got some awesome tables.
- 10:45The first thing is a table.
- 10:46Yeah.
- 10:46And there are 10 tutorials here.
- 10:50And there are a lot of them are based on code.
- 10:53A lot of them from R and stuff like that.
- 10:55But which one should, which one do you think we should talk about?
- 10:57Just as an introductory example, maybe.
- 10:59Pretty good one is the first one.
- 11:01The very first.
- 11:02Like it leads with a table at the very top of the page.
- 11:04It's called.
- 11:05So there's conference realignment travel.
- 11:08Yeah.
- 11:09And right away.
- 11:09So if you, yeah, if we open this table up, there is, there's pictures.
- 11:13Like, so this talks about like, what is this?
- 11:16A basketball college, American basketball.
- 11:18Yeah.
- 11:19So you've got the logo or the icon, you know, like the Stanford tree or the Miami, Florida
- 11:26U, which is like the school colors.
- 11:30And you've got little chiclets of the information.
- 11:34It's, those are also embedded in sort of a heat map.
- 11:37There's a lot more that there's a lot of pieces of this conveying information all at the same
- 11:42time.
- 11:42You want to maybe just riff on that a little bit.
- 11:45Yeah.
- 11:45I don't mind trying to tackle this table.
- 11:47I'm just taking it in.
- 11:48I think, I think it's really nice.
- 11:50So this table, yeah.
- 11:51Basketball realignment travel in the ACC.
- 11:54So they're talking about, I guess, how hard would it be for these teams to drive to games?
- 12:00And so in the table, every row is a team.
- 12:03And they use like the logos next to the team name.
- 12:06So it's really fast to look up.
- 12:08And then in the columns are things about like, yeah, visiting arena to home arena.
- 12:13So like how, how many miles would it take for this team to travel to the arenas they're going
- 12:19to?
- 12:20And I think that what's nice about this table is, for example, there are multiple measures
- 12:26of how many miles it would take a given team to go to their visiting arenas.
- 12:32So for example, on the first row, we have California.
- 12:35And in columns, we have like median miles for one column and average miles for another column.
- 12:43But I think what's nice about just kind of basic table structure is because these two columns,
- 12:48medium miles and average miles are both kind of about a similar thing.
- 12:52They're able to put a label over it called a column spanner, and they label it visiting
- 12:57arena to home arena.
- 12:59So they're able to do a little bit of grouping of information.
- 13:02So you can see like these two measures, these two columns are related to each other.
- 13:07And then I like...
- 13:08Yeah.
- 13:08Michael, that's a super interesting point that I think is very well represented in gray tables.
- 13:13And that is almost multi-dimensional data.
- 13:17Yeah.
- 13:17Right.
- 13:18And so, like you say, it's got three columns here, median miles, average miles, and then
- 13:22this other geographic center column.
- 13:25But above those, there's like groupings.
- 13:27Like these two columns speak to how far is the visiting arena from home versus the other one
- 13:34is just sort of an extra description, right?
- 13:37So you're able to say, here's this axis of information, but you can really group them together
- 13:42and think of them as something else it's representing almost or something combined, like a projection.
- 13:47I don't know, something like this.
- 13:48Yeah, totally.
- 13:49And I think the interesting thing too is like in databases or in data analysis, this kind
- 13:54of structure is there, but it's not visual oftentimes.
- 13:57Like someone might have a table and they might have two columns, one for like median miles,
- 14:03average miles, but they might actually like, oftentimes people in the name will put the grouping.
- 14:09So like if those two columns are related, they might say like visiting, you know, prefix it
- 14:14with like visiting underscore.
- 14:16And so it's interesting, like tables, raw data tables often have these hierarchies, but
- 14:21this kind of lets you pull it out visually.
- 14:23So like the human eye can quickly kind of group things.
- 14:27And then to your point about multi-dimensional, that is kind of like one of the big benefits
- 14:32of a table is that this, for example, this table has three columns related to miles and
- 14:39a plot.
- 14:39You could show that in a plot.
- 14:41You could plot two columns against each other with a scatter plot and maybe use the third
- 14:46column another way through like color or size.
- 14:49But at that point, you've kind of maxed out the plot.
- 14:52There's not a lot more you can do.
- 14:53A table, you can just keep adding columns and they don't even have to be numeric or like
- 14:59kind of on the same scale.
- 15:01You could add like all kinds of information in columns and keep going.
- 15:05And I think to your point of it being multi-dimensional, that's one kind of nice thing table support is
- 15:10many measures on the columns.
- 15:13Yeah, absolutely.
- 15:14This portion of Talk Python To Me is brought to you by Posit, the makers of Shiny, formerly
- 15:19RStudio and especially Shiny for Python.
- 15:23Let me ask you a question.
- 15:25Are you building awesome things?
- 15:26Of course you are.
- 15:27You're a developer or data scientist.
- 15:29That's what we do.
- 15:30And you should check out Posit Connect.
- 15:32Posit Connect is a way for you to publish, share and deploy all the data products that you're
- 15:38building using Python.
- 15:39People ask me the same question all the time.
- 15:42Michael, I have some cool data science project or notebook that I built.
- 15:45How do I share it with my users, stakeholders, teammates?
- 15:49Do I need to learn FastAPI or Flask or maybe Vue or React.js?
- 15:53Hold on now.
- 15:55Those are cool technologies and I'm sure you'd benefit from them, but maybe stay focused on
- 15:59the data project.
- 15:59Let Posit Connect handle that side of things.
- 16:02With Posit Connect, you can rapidly and securely deploy the things you build in Python.
- 16:07Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Ports, Dashboards.
- 16:12And APIs.
- 16:13Posit Connect supports all of them.
- 16:15And Posit Connect comes with all the bells and whistles to satisfy IT and other enterprise
- 16:21requirements.
- 16:21Make deployment the easiest step in your workflow with Posit Connect.
- 16:26For a limited time, you can try Posit Connect for free for three months by going to talkpython.fm
- 16:31slash posit.
- 16:32That's talkpython.fm/P-O-S-I-T.
- 16:36The link is in your podcast player show notes.
- 16:37Thank you to the team at Posit for supporting Talk Python.
- 16:42Out of the audience.
- 16:43Carol points out that the ACC used to be mostly Southern based, but now they span the whole
- 16:48U.S.
- 16:48But what you can see from this chart is all, or this table rather, that all the Southeast
- 16:54based universities have a much easier time.
- 16:59The color of their little chiclets of distance are all very light colored.
- 17:05Whereas if you look at all the California West Coast, it's like distance across the U.S.
- 17:10is your average distance you travel to each game.
- 17:13And it's pretty wild.
- 17:15You could probably put in things like, what is the team's typical winning outcome based by distance?
- 17:24If it has to play a team that is twice as far away, are the players more likely to show up tired
- 17:31and not quite be able to play as good?
- 17:34And then that might somehow affect the rankings just based where you physically are located.
- 17:39Yeah.
- 17:39That's what makes this a good table because it basically tries to get that slice of the
- 17:43data, right?
- 17:44That one view of the data and present it so nicely.
- 17:47And then it causes you to think those things, right?
- 17:49To explore further.
- 17:50Yeah, exactly.
- 17:51I don't know what I would have been able to do before.
- 17:53Yeah.
- 17:54Yeah.
- 17:54But looking at the colors, you're like, oh, California, as in Berkeley and Stanford and those
- 18:00types of schools, they're much darker versus Louisville, which is not very much, or Duke
- 18:08or all these other teams.
- 18:09And then you start to realize, oh, maybe distance does play an important role.
- 18:13It just jumps right out, even though this is not a thing that I think about or care very
- 18:18much about on a lot of levels.
- 18:19But, you know.
- 18:20Yeah.
- 18:20And even to Michael's point, that last column is like a total qualitative measure or not
- 18:26qualitative, but it's basically just like a label rather than like a number, essentially.
- 18:30So it's much easier.
- 18:32In a plot, I don't even know how you would do that.
- 18:34You just, I guess.
- 18:35But here you can.
- 18:36Just to describe the last column is, you're talking about like furthest.
- 18:40So the last column shows what's the furthest team from.
- 18:44So each row is a team.
- 18:45The last column is essentially what's the furthest team from you.
- 18:48And they're able to just put a logo in to get a quick kind of snapshot.
- 18:52And you can play on that extra column.
- 18:55Basically, if you were to play an away game at that team, that's the worst travel for you.
- 19:00But at least measured by distance.
- 19:01It's not like by time.
- 19:03And like if you're taking a flight, you could have three connections to a small town versus
- 19:07a direct one that's far away.
- 19:08Right.
- 19:08Like there's different metrics you might apply to what defines furthest.
- 19:12But that's a neat idea.
- 19:13Yeah.
- 19:14It's interesting though.
- 19:14Right.
- 19:14Because they didn't put bother to like rewrite the name of that team.
- 19:17They just economize the space and just like threw it in in case you're interested.
- 19:21It's like.
- 19:22Yeah.
- 19:22And the value for that column is not the name of the school.
- 19:25It's the school logo.
- 19:27Yeah.
- 19:28And I will say, I can't believe that the year is 2024 and we just had a five minute
- 19:34discussion on the design of a single, I didn't imagine myself being here a year ago, but it's
- 19:41really.
- 19:41This is the problem.
- 19:42I'm telling about it to me.
- 19:43Yeah.
- 19:45Amazing.
- 19:45I feel like Edward Tuftay must come into existence a lot for you guys.
- 19:52But it kind of goes to show tables can be cool, right?
- 19:54Like we're actually talking about this table and it's interesting.
- 19:58And it's good to look at.
- 19:58And I'm like, I don't know.
- 20:00Like this is like a leisure thing.
- 20:02I'm not compelled to look at this.
- 20:04Yeah.
- 20:04I'm looking at this for fun.
- 20:05And like, it actually is okay.
- 20:06I enjoy looking at this table.
- 20:09Yeah.
- 20:09Yeah.
- 20:10I'll pull one more down.
- 20:11I have no idea what I'm going to be getting here, but let's do Spotify listening.
- 20:15How long do I listen to my top artists before skipping?
- 20:18Yeah.
- 20:18I think to your Tufte point too, this is a good example that you can have, you can have a
- 20:23little bar chart inside your table.
- 20:27So like this, this table, how long do I listen to my top artists before skipping?
- 20:31Each row is an artist with some information about them.
- 20:37And then the big thing it sounds like is this average stream duration column, which has a
- 20:42bar of how long people stream them on average, maybe before skipping.
- 20:47Yeah.
- 20:47I love your point about Tufte.
- 20:48Like this idea that you can encode a small graph, like visual, like a bar is very, I think
- 20:55Tufte, like with sparklines and things like that.
- 20:57Tables can have a really compact representation that bring in some of the value of charts.
- 21:04But also it's like, it's like three quarters table, one quarter chart.
- 21:09And that's kind of common.
- 21:10For those out there who don't are not steeped in Edward Tufte sort of lore.
- 21:15He's a guy who thinks very deeply about data presentation, not necessarily tables or graphs or
- 21:21whatever, but just, I have a bunch of kind of data stats based information.
- 21:25And how could I possibly present this in the way that conveys the most information easiest?
- 21:30So on.
- 21:31So yeah, he's got, he's got some great books, some great presentations out there.
- 21:35That's why I brought it up.
- 21:36Cause it's his whole career is about how do you present data basically.
- 21:40Right.
- 21:40And if you guys should add to that, what do you think?
- 21:42I think there is a, I don't have it on hand.
- 21:45There is a quote, I think from Tufte, I don't want to butcher about, there is some analysis
- 21:50he's done of tables of like, like your entry architecture or something, which is essentially
- 21:54like the structure of the table where you enter it as a user.
- 21:58And then like how you read usually determines your like orientation.
- 22:02So like, if you're, if you're reading left to right, there's usually like the table structure
- 22:06has like an entry point.
- 22:07And then if you're reading left to right, it kind of determines how you're going to go through.
- 22:12He's done some thinking about tables as sort of architectures, I think, but I haven't, I haven't
- 22:19gone too deep into it.
- 22:20Me neither.
- 22:21But I guess that informs like things like sorting that we saw in other tables.
- 22:24Like there's a dominant sort, the most important things are at the top, maybe least important,
- 22:28but there's, there's definitely some sort of like, you know, like conscious sorting.
- 22:31And like, it's obvious what it is and it's just to sort of serve a purpose.
- 22:36Yeah.
- 22:37There's probably an art to finding the thing that attracts your attention first.
- 22:41And so then as you progress through looking at it, you can do so in a deterministic, purposeful
- 22:46way rather than just, you know, you land anywhere and you start looking around visually.
- 22:50Yeah.
- 22:51Yeah.
- 22:51Yeah.
- 22:52It's wild because like it is such a, such a creative act making a table.
- 22:56It seems weird to say it.
- 22:57It's not just results.
- 22:58You just slap down.
- 22:59You have to envision yourself in the viewer's shoes and like how to, how they would
- 23:03ingest or like digest information in the most easiest manner possible with all sorts of like
- 23:09little affordances, like the way you format things, space in between columns, all sorts
- 23:13of wild, little tiny details.
- 23:15They all really combine to like make something really good or to make the table shine.
- 23:20I guess you can say.
- 23:21Yeah.
- 23:21Yeah, absolutely.
- 23:22I want to come back to this one about the listening.
- 23:25and I'll, I'll link to all these in the show notes, of course, here we've got the average
- 23:30stream duration and it's represented by little bars in the table itself, which we've already
- 23:35talked about, which is awesome.
- 23:36And the values are things like 87%, 80%, 84%, whatever that little section is fraught with
- 23:43possible misrepresentation.
- 23:45So if that was just a number and it was average seconds, well, if you listen to say the scorpions
- 23:52or some of the older rock bands or iron maiden, I don't know where they have songs that are
- 23:58like seven or eight minutes long versus more modern songs that are, it may be two and a half
- 24:03minutes long.
- 24:04And it said, Hey, look, I only listened to these like two and a half minutes, but I listened
- 24:08to the scorpions for three minutes.
- 24:09That must be the winner, right?
- 24:10Like, no, you're not even listening close to the same amount.
- 24:13So putting numbers even there, even before you would normalize them, right?
- 24:17Just put them as a percent of, of that, as like the total average of the song or something.
- 24:21There's a lot to think about with these things and that can kind of go away with these graphs,
- 24:26right?
- 24:26You don't have to worry about that.
- 24:27You're like, Oh, you don't have to worry about how long is their average song.
- 24:30You can see, you know, just how long did I listen to their stuff?
- 24:34That's kind of cool.
- 24:34Yeah.
- 24:35It's really cool.
- 24:35And it's a great use of space too, right?
- 24:37Like horizontal bar plot.
- 24:38I mean, these are like rows, which are not that high, but you still fit a plot in.
- 24:43We don't have that many choices, but, horizontal bar plot.
- 24:46Yeah.
- 24:46It could be just a couple of pixels high and you can still see, see that kind of information
- 24:49super well.
- 24:50Exactly.
- 24:50As long as you use enough color or whatever.
- 24:52All right.
- 24:52Well, let's talk about great tables.
- 24:55So I feel like we probably have set the stage well enough for, for people to go, okay,
- 25:01maybe there's, maybe there's something here rather than just, you know, header rows and columns.
- 25:06So tell us about great tables.
- 25:08When did it come into existence?
- 25:09Why do you guys build it?
- 25:11What is it?
- 25:11Yeah.
- 25:12Yeah, sure.
- 25:13So I actually started from an R program or package a long time ago back in 2018.
- 25:18and like, there was like essentially like a list of projects that were sort of like,
- 25:23I'm not being handled at our, at then our studio now posit and tables was there.
- 25:28It was like, Oh, this seems like such an obvious one.
- 25:29I will take that.
- 25:30I will work on that.
- 25:31And I have an interest in that.
- 25:33I'm going to do it.
- 25:34Nobody else did it.
- 25:35It was on that list for years.
- 25:36And it kind of begs the question, like why?
- 25:38Because tables are such omnipresent, you know, way of presenting data.
- 25:43I see it like in, I don't know, like journal articles, like half the things are tables, half
- 25:47things are plots.
- 25:48and they're, you know, everywhere else.
- 25:50So like, yeah, there should be this thing.
- 25:52So I decided to just get going on that.
- 25:55And, as, as Michael said, like, it's a lot of code and like, I didn't envision
- 26:00it would take that much code.
- 26:01I thought it'd be rather simple working with HTML table and then, you know, expanding towards
- 26:05other types of like table outputs, like a PDF, you know, word and stuff like that.
- 26:10but I thought, you know, those would be bite-sized little things as it turns out tables
- 26:14run pretty deep.
- 26:15and I really only found that out when looking at, I was doing some like literature review
- 26:20and I found that 1949 census manual, it's like the review of tabular, presentation.
- 26:25Yeah.
- 26:26It's a great PDF that lives on the internet.
- 26:28It's always there.
- 26:28Thanks.
- 26:29Whoever put that up.
- 26:30What year is this from?
- 26:301949.
- 26:3149.
- 26:31Yeah.
- 26:32It's, it's like a janky scanned in thing.
- 26:36Yeah.
- 26:36But that's only a line, but it's, you know, this is like hundreds of pages of table stuff.
- 26:43It's both a style guide for the census at the time.
- 26:46And also just like an amazing reference for anything in tables and even just presenting
- 26:51data.
- 26:51Like they, they go so deep on the smallest little things.
- 26:55It's incredible.
- 26:56Yeah.
- 26:56They sketch things out.
- 26:57They give things names.
- 26:58That was super important because otherwise he'd just be saying that area on the top left,
- 27:02whatever that is.
- 27:03It's good to have names.
- 27:04It's like design patterns for.
- 27:06Exactly.
- 27:07Yes.
- 27:07And this is what was needed.
- 27:09And I'm pretty thankful I found this.
- 27:10Otherwise we'd have to make it up, but this seems like as close to a standard as we'll
- 27:14ever find on this sort of thing on making tables.
- 27:17Right.
- 27:18So in 1942, we have the formal table and its major parts continued, you know?
- 27:23Yeah.
- 27:24Yeah.
- 27:24And there's so much good text.
- 27:26Like it's expertly written.
- 27:28this stuff, I mean, of course these are tables in print and of course we have the web.
- 27:33So that changes things a little bit, but you'd be kind of surprised how, how, you know,
- 27:37still relevant these recommendations are.
- 27:39They teach you to be economical with how much data you put on, how much, basically the
- 27:43Tufte thing, how much ink are you going to like spend on a visualization?
- 27:46And, it just carries it through to all the different parts, which is, you know, amazing.
- 27:51And we took a lot of that and applied to here as best as we could, you know, with some
- 27:54more modern things as well, but, yeah, of course, but it's yeah, pretty much a very
- 27:59useful reference, like the foundational reference for this.
- 28:02So right on the great tables page, you've got the components of a table.
- 28:06Yeah.
- 28:07You want to give us a sense of what's beyond header rows and columns?
- 28:10Yeah.
- 28:10Michael, would you?
- 28:11Sure.
- 28:12Yeah.
- 28:12Yeah.
- 28:13I think so.
- 28:13I mean, I think even just the very first thing at the top, this table header with a title and
- 28:19a subtitle that's like, that, that seems like a really simple thing, but I think that it's
- 28:24easy to overlook.
- 28:25like a lot of people think of a table as just the like data and maybe some labels.
- 28:31But if you think about like the information hierarchy and someone who has maybe 10 seconds,
- 28:37five seconds to figure out what's going on.
- 28:39As it turns out, the title is probably the most, one of the most important parts because it tells
- 28:44them in two seconds, what should I expect from this thing?
- 28:48So like, if you send to your boss a table, if you had to do one thing, you should probably
- 28:52put a title on it so that they know what you're sending to them.
- 28:56And I think, so that's like, maybe a silly thing.
- 28:59Maybe it feels like table stakes, but I think like the title and the subtitle are small elements
- 29:04that really kind of, if you're thinking of a table as communication, you, you wouldn't
- 29:09write an article without a title.
- 29:10so this really is just.
- 29:13Probably wouldn't put a graph up without a title.
- 29:15Right.
- 29:16Yeah.
- 29:16Right.
- 29:17So it's kind of bringing tables up to the standard of other communications.
- 29:21Yeah.
- 29:22And then I think, the other thing I really like is these are really simple elements,
- 29:26but these footnotes on the bottom and source notes, this idea that if you just create a
- 29:31spot for your like references, it's a lot easier to get into the habit of, of referencing
- 29:37where things came from.
- 29:39So like we have some table examples in our gallery and they, in their footnotes, they often
- 29:43say where, we got them from.
- 29:45And it's just so, so helpful having that like hook that you can hang into to quickly, like
- 29:51as a quick reminder that if you, like, if you make it easy to put your references and footnotes,
- 29:56you know, you just can make a habit of it.
- 29:58So those are kind of funny.
- 30:00Those are like the bookends of a table, but I really appreciate that they're there to
- 30:05emphasize how critical they are.
- 30:07If tables are a form of, communication.
- 30:10Yeah.
- 30:10The one that stood out to me and I called out at the first table we talked about was the
- 30:15spanner label.
- 30:16That kind of says these three columns are kind of in some category together.
- 30:21Yeah.
- 30:21Yeah.
- 30:21The hierarchy is pretty important.
- 30:22It lets you sort of like, Oh yeah, I care about this package of, or this set of columns,
- 30:27or maybe I don't, maybe I care about these ones over here.
- 30:29You just quickly get oriented to like the columns that, you know, are more useful.
- 30:33And also it allows you to do that thing that Michael mentioned before.
- 30:36You don't have to like have tons of like label on the below columns, like on one label or
- 30:41tons of text on one label.
- 30:42You can split it up between like spanner and then like the things that it's associated to,
- 30:46you know, the columns.
- 30:46So you might have things like, some type of measure and then like the units for the
- 30:50column labels, for instance.
- 30:51Yeah.
- 30:52In our basketball example, it could be distance from visiting arena that could just have average
- 30:57or miles from visiting arena and then just average and median.
- 31:00And that's all it has to say, but you wouldn't have average and median.
- 31:03And that's called them like, unless it was really, really clear, but in a complicated
- 31:07thing, it wouldn't make sense to just have those two words like average or what, you know?
- 31:10Yeah.
- 31:11As part of that visualization, thoughtful design is about, allows you to be creative and also
- 31:15thoughtful for the user or the reader, I should say.
- 31:18I think it helps too.
- 31:19Cause a lot of tables I've seen go big on columns.
- 31:21There's like quite a few, there can be tons of columns.
- 31:25And so I think when you have like, let's say you have a dozen columns, if you have like
- 31:29two or three spanners over them, it feels easier.
- 31:33It feels like closer to a table with three columns in a sense.
- 31:36When you get started, you kind of know what you're getting into.
- 31:39So you can kind of ease into it.
- 31:41Yeah.
- 31:41You can kind of zoom in by picking a spanner and then paying attention to those pieces or
- 31:45something.
- 31:46Yeah.
- 31:46Yeah, totally.
- 31:47As well.
- 31:48Having these tools at your disposal as well.
- 31:50Also kind of like lets you be, I guess, creative, but also it gives you options to, to explore
- 31:55different ways of creating a table.
- 31:57If you didn't have like the ability to put a spanner, say in this program, this, this Python
- 32:01library, you'd have to think of other ways you'd have to, it, it basically changes your
- 32:06whole presentation, not having options to do so.
- 32:08Right.
- 32:09You'd want to try to leverage color maybe to try to infer their group somehow, but then
- 32:14yeah, it's still, it's incomplete.
- 32:16Yeah.
- 32:16For sure.
- 32:17Yeah.
- 32:17So a non out in the audience asks, like there's a lot, R has lots of great examples, but I've
- 32:23struggled since it's not equivalent in Python.
- 32:25Let me suggest.
- 32:26Oh yeah.
- 32:27I kind of feel like, like great tables is the entry point for a lot of that.
- 32:32Right.
- 32:32What do you think?
- 32:33Yeah.
- 32:33I think too, maybe something rich you can hit on is there's a lot to appreciate from the
- 32:37history of R. Like it's really surprising to people how hard people have gone on tables
- 32:43in R.
- 32:44Yeah.
- 32:44And some of everything leading up to rich working on GT and R tables in R in 2018.
- 32:50There's actually like a 20 year history leading into that.
- 32:54Yeah.
- 32:55That maybe rich.
- 32:55You can talk a bit about the kind of.
- 32:57Yeah.
- 32:58Before you guys just jump in real quick.
- 33:01You guys both are, we didn't catch this in the introduction, but you're both working at
- 33:07Posit, the company that created Shiny.
- 33:09It was an absolute leader in R and now has Shiny for Python and all those kinds of things.
- 33:14So just adding some background.
- 33:16Yeah.
- 33:16History for everyone.
- 33:17Okay.
- 33:17Go ahead.
- 33:18Yeah.
- 33:18So basically R goes back probably about as far as Python, 90s or so.
- 33:24But R seemed to have a head start on tables.
- 33:27I mean, as far back as 2000, they had a LaTeX sort of table generating package.
- 33:33And then in the intervening years, the decades since up to now, they've had upwards of eight
- 33:39to 10 table packages.
- 33:41I think had to do with the fact that data frames are just like, you know, as part of the language.
- 33:44So it just made sense to make a table.
- 33:46And also they just had, I guess, a lot of tooling for creating PDFs, especially for like
- 33:51package like references.
- 33:54So basically R has tons of like examples, vignettes and things like that.
- 33:57Maybe not so much on the Python side.
- 33:59We're trying to get that in.
- 34:01Although I've been maximal on the table examples for the R version of this, which is called GT.
- 34:06Haven't quite got there yet on the Python side.
- 34:09So if you're seeing less examples, then you might see on the R side, make sure that they
- 34:13are coming soon.
- 34:14Yeah.
- 34:15Still working on it.
- 34:17Yeah.
- 34:17So let's talk about, let's talk about the Python side about what is my data journey to
- 34:22get something into great tables and then maybe what comes out of great tables.
- 34:27So it starts with sounds like data frame libraries.
- 34:30What ones are supported?
- 34:32How's that work?
- 34:33What's the most ideal one?
- 34:35Yeah.
- 34:35So we, we support out of the gate pandas and polars.
- 34:40And we have, we've made this into lean pretty hard on polars in our examples, just because
- 34:47it has some kind of special moves that work really well with great tables.
- 34:50So for example, selectors and stuff, right?
- 34:53Yeah.
- 34:53Selectors.
- 34:54So that really was eyeopening to us.
- 34:56And I think the polars team a little bit, I think they hadn't, I think great tables was
- 35:00one of the first packages that went really hard in integrating with polar selectors as part
- 35:05of our API.
- 35:06So there are like, if you want to set a spanner label, so you want to set a label over some
- 35:11columns, you can use polar selectors to do that in great tables.
- 35:15And that's a really nice, that's, that's what we do all the time.
- 35:18And it's really convenient.
- 35:19I think that that was kind of an early use of an external package for the polars team
- 35:25using their selectors and stuff.
- 35:27So we, we had a lot of communication with them about it early on, but I would say, so it takes
- 35:34a pandas or a polars data frame.
- 35:35And we've leaned pretty hard into polars just because of some of these really nice affordances.
- 35:41Yeah.
- 35:41If you go to the get started guide, you'll see it inside of selecting table parts and then
- 35:46like selecting columns.
- 35:47I believe we have this little sidebar, which sections up the getting started.
- 35:51Oh boy.
- 35:52Yeah.
- 35:52Okay.
- 35:52Getting started.
- 35:53Oh, if you go to the very bottom on the sidebar.
- 35:56So scroll down.
- 35:58Yeah.
- 35:58Yeah.
- 35:59That.
- 35:59Column selection.
- 36:00Column selection.
- 36:01So sorry.
- 36:01There we go.
- 36:02Yeah.
- 36:02There's a whole using polar selectors section.
- 36:06Yeah.
- 36:06Here we go.
- 36:07Here we go.
- 36:07Yeah.
- 36:07Yeah.
- 36:08So that's just an example of dropping polar selectors into the great table method to move
- 36:15certain columns to the beginning of the table.
- 36:17Yeah.
- 36:18Or you might do another example where you choose a number of columns to put a spanner over
- 36:22top of, and they might be named in a systematic way, which is like the advantage here.
- 36:26And you can do it for pandas as well.
- 36:29Just not with selectors.
- 36:30You just use lambdas and such to have similar functionality.
- 36:33Interesting.
- 36:34Okay.
- 36:34Yeah.
- 36:35So yeah.
- 36:36Pandas are polar's polar's has some really nice benefits like selectors.
- 36:40And then it also, it's used quite a bit whenever we style a table.
- 36:44We often use polar's expressions to kind of target the areas to style.
- 36:50So if you want to choose like for this column, make the maximum value of the column yellow.
- 36:56It's really easy with polar's expressions to say, you know, when this column is equal to
- 37:03the max value in itself.
- 37:06I see.
- 37:06Yeah.
- 37:07That's really cool.
- 37:08And because then you don't have to figure out what the max is and then try to come up
- 37:12with a gradient range of it.
- 37:13You just put it into little bins or whatever.
- 37:16Yeah.
- 37:17Yeah, exactly.
- 37:17Totally.
- 37:18One thing I just noticed that's pretty sweet about this actually is you, you already talked
- 37:23about the sources and the references and things like that.
- 37:26Yeah.
- 37:27But I just noticed that you have markdown support for your references.
- 37:31Yeah.
- 37:31That's a good one.
- 37:32Because like sometimes you want to bold italicize things, maybe make a list within your footer,
- 37:37your source notes.
- 37:38Yeah, sure.
- 37:39I mean, even in the official way you're supposed to reference things, there's stuff that's supposed
- 37:44to be italicized and stuff that's not right.
- 37:46Exactly.
- 37:46Yeah.
- 37:47So you want these tables to be useful for like a wide range of people.
- 37:52And if they didn't have that, I don't know what they would do.
- 37:54They'd just use HTML, I guess, and try their best with tags.
- 37:57But this is just an easy, obvious way to make it simple.
- 38:02Yeah, that's really great.
- 38:02So we start with some data.
- 38:04We load it ideally into polars, it sounds like, but pandas is also supported.
- 38:08And then you kind of visually, I say visually, the indentation of the way the code looks somewhat
- 38:15represents the structure of the table.
- 38:17A little Flutter or HTML-esque in that sense.
- 38:21Yeah.
- 38:21Yeah, totally.
- 38:22I think we think a lot of it about in terms of three main activities, structure, format,
- 38:29and style, and we've tried to make the method names match up a bit.
- 38:33So everything starting with tab is basically about structuring the table.
- 38:37So that's those big pieces in the diagram we looked at, whether it's setting the title with
- 38:43tab title or tab header or setting footnotes.
- 38:47Those are all structure activities.
- 38:49So they all start with tab.
- 38:51And then there's this just incredible bucket of formatters.
- 38:54Rich really went ham on formatting methods.
- 38:57So it's everything starting with FMT.
- 39:00This is like, yeah.
- 39:01Yeah.
- 39:02This is like, maybe you want to format the number of decimal places, but Rich has gone even further
- 39:08to like, maybe you want to put like a country flag in your table.
- 39:12Rich has got you.
- 39:14He wanted it to be easy for country flags.
- 39:17And I'm here for it.
- 39:19Yeah.
- 39:19So those little graphical elements are amazing for quickly conveying information.
- 39:24Kind of like the logo of the various universities that you would see on SportsCenter or whatever.
- 39:29You're like, yeah, that's what I'm used to looking at.
- 39:30Yeah.
- 39:31That's right.
- 39:31You just use format image for that.
- 39:32And you just, yeah.
- 39:33Give it an image on disk or wherever.
- 39:35And it gets in there.
- 39:38Yeah.
- 39:38Yeah.
- 39:38And I was kind of confused why I was adding so many formatters at first.
- 39:42But I feel like the thing that really clicked for me is that if you think about, so if you
- 39:46go, actually, if you go up to the very top and then into the reference on the top bar, that
- 39:52will have lots of formatters under, yeah, format.
- 39:55Yeah.
- 39:56They're just listed out.
- 39:57So what clicked for me is that spreadsheet users.
- 40:02So people in Excel making a table are really used to tons of convenient things like formatting
- 40:07dates, formatting.
- 40:08Right.
- 40:09You highlight a column, you press currency, then you press the move, the decimal point, two points
- 40:13to the left to drop the portion, the partial ones and all that.
- 40:16Yeah.
- 40:17Yeah.
- 40:17So there's a world like the engineer in me thought like, ooh, I kind of wish this wasn't
- 40:22our job to do all this formatting.
- 40:24But I think Rich very intuitively picked up on like, well, if people use Excel for tables,
- 40:30I think you have to give them a compelling reason to be able to do it all in Python, or
- 40:35they're not going to really want to make the jump.
- 40:37And so I think having all these formatters is just a way of bringing that kind of nuts
- 40:42aspect of Excel into great tables.
- 40:45And some of this stuff is tough and fiddly if you do it yourself.
- 40:49I'm not just talking about simple format.
- 40:51Like strings.
- 40:52Yeah.
- 40:53Yeah.
- 40:53I'm talking about.
- 40:53Yeah.
- 40:53Can I do like a colon and then a comma and then a 0.2 and we're done?
- 40:57Yeah.
- 40:58First you got to do that.
- 40:58And then like, there might be some other weird things.
- 41:01So we try to like make it super simple with just some simple options, some arguments and
- 41:05you're pretty much there.
- 41:06Yeah.
- 41:07One thing I'll maybe give a shout out.
- 41:09I know you talked about it, PyCon, was if you've got a bunch of numbers, like let's say
- 41:14it's currency.
- 41:14You might want to format that using like, if it's over a million, 1.2 M.
- 41:20But if it's only 120,000, you might want to say 120 K.
- 41:25Yeah.
- 41:26Right.
- 41:26Something where it's.
- 41:27Yeah.
- 41:28You don't need sort of an abbreviator.
- 41:30Yeah.
- 41:30It's, it's also useful if you have like tons and tons of numbers, like a wall of numbers,
- 41:33you're running out of space.
- 41:35So you just need to compactly.
- 41:36And like the small figures don't really mean much.
- 41:38Like you just want broad strokes.
- 41:39Like it just can be the compact thing.
- 41:41It's great.
- 41:41And it works really well for like things where you don't need to have that much precision.
- 41:45Based on the.
- 41:46Yeah.
- 41:47You also seem to have taken a pragmatic approach where it's not like, well, you're not, we're
- 41:52not going to let you mix units in a column.
- 41:55Right.
- 41:55If it's, it's not, you know, kilometers and meters, like it's all kilometers.
- 42:00It's all meters.
- 42:01Take it or leave it.
- 42:02You know?
- 42:02Yeah.
- 42:02I think.
- 42:03Freedom, baby.
- 42:04That's what you want.
- 42:05You can like, you can target.
- 42:07So we have like a column targeting system, but you can also like sort of like subset,
- 42:11like what rows you want.
- 42:13So that's the way.
- 42:14So basically you can like format different ways down the column if you so choose to, which
- 42:18makes it more flexible.
- 42:19Yeah.
- 42:20I think, I think it goes back to, to Excel and, you know, Excel is just a big lump of
- 42:24clay.
- 42:25You can just carve out your table however you want.
- 42:27And it, it does like do formatting, but it doesn't prescribe.
- 42:30Yeah.
- 42:31Like you said, it doesn't constrain you to have to like do it for a whole column.
- 42:35And I think that's like, we're endlessly surprised by the types of tables people create and the
- 42:41things they communicate.
- 42:42And in a way it's like leaving room for surprise that people are so creative.
- 42:48You, you want some constraints, but you kind of also want to let them surprise you with things
- 42:54you wouldn't think of, but that end up being really useful.
- 42:57And I don't doubt someone's there like mixing all kinds of things in ways I wouldn't
- 43:02imagine, but end up kind of working out.
- 43:05I think it was like in our table contests where I was like first surprised.
- 43:08Basically we, we, we throw together table contests at, at posit.
- 43:13It's such a nerdy thing, but like people submit tables and they get judged on them.
- 43:17Like they, they get prizes.
- 43:18Everyone's a winner.
- 43:19Rich is a very kind judge to be sure.
- 43:21It's like everybody wins in Rich's house.
- 43:25Yeah.
- 43:25But they're so good.
- 43:27Like when I see his tables, I'm like, I never even thought of that.
- 43:29Like that, that could be done.
- 43:30You'd want to do that.
- 43:32And I actually like it.
- 43:33Like, yeah, it's actually inspiring every time.
- 43:36It's gotta be pretty hard to build a framework around such a visual flexibility, you know?
- 43:41Yeah.
- 43:42But still have some kind of something prescriptive, right?
- 43:44Yeah.
- 43:45I guess the trick is just like have easy conveniences just to do broad swaths of formatting and styling,
- 43:51but also make it granular.
- 43:52Give people power, I guess you could say with, along with simplicity.
- 43:55Yeah.
- 43:56So tell people about these contests.
- 43:57If somebody wants to try, try their hand at great tables and submitting something, you know,
- 44:02I think we're even in the advent of code time.
- 44:06And I guess we just had the hour of code stuff, but there's a lot of these things where people
- 44:09are trying, I just need some examples to play with, to try to, to learn a thing.
- 44:13Right?
- 44:13Yeah.
- 44:14So we do it in the summer, so not wintertime, which is actually good for submissions.
- 44:17So it's still coming up.
- 44:18Yeah.
- 44:19Yeah.
- 44:19And we give a generous amount of time, I think like two or three months, if I remember correctly.
- 44:23But yeah, we just, we just made the call, say, submit your table.
- 44:27We have a nice form and people submit them.
- 44:30And we sometimes get up to 50, not 80 entries.
- 44:33It's like, we get quite a few.
- 44:34And then we, we do the tough job of, you know, having a number of judges and just, you know,
- 44:40multiple judge grading of the tables.
- 44:42And we had so many that we had to split them up into categories, right?
- 44:45Because we were going to celebrate all these different types of tables and different domains
- 44:49of, you know, have typically different types of tables.
- 44:52And so it just makes sense to break it up in that way.
- 44:55Yeah.
- 44:56And I do, if I had to give advice, it's like much more free form than a lot of the advent
- 45:00of code.
- 45:00There's no, because there's no target or even necessarily starting point.
- 45:05It could be really hard for some people, I think, to get started or figure out like, what
- 45:09could I do with this?
- 45:10But I think if I had to give any advice, I think looking through the past entries is so
- 45:15helpful, like scanning past entries and even choosing some that inspire you.
- 45:20And then whether it's, whether you take data similar to those and maybe try to do something
- 45:25related or go in like a similar direction and look for new data.
- 45:30I think the existing entries are really, really inspiring.
- 45:33I, if I had to-
- 45:35Get that creative juices flowing, right?
- 45:36Like, oh, I didn't even think you could go down that direction.
- 45:38Let's try that with my data.
- 45:40Yeah.
- 45:41Yeah.
- 45:41Because I think if you start with just a blank page and you're kind of new, even to
- 45:46great tables, it can be hard to know where to go.
- 45:48But once you start looking at entries, I think you get a feel for all the kinds of things you
- 45:51can do with it.
- 45:53Oh, that sounds great.
- 45:54How important is it that you have interesting data to start with?
- 45:58Like, hey, let's grab the data that they use to image the first black hole, try to make
- 46:04a cool picture out of, you know, table picture out of that.
- 46:07That's a great question.
- 46:09I think it really hits on one of the neat things about these contests is that you don't
- 46:14have to have interesting data at all.
- 46:15Actually, one category of entry is kind of zany.
- 46:18It's like recreating something that exists in, say, like great tables or some other library.
- 46:25Like Rich and I were talking recently about GitHub issues.
- 46:29So like GitHub issues are a really interesting example of a table because they're a table that
- 46:35software developers work with nonstop.
- 46:37Like I'm all in those tables all day.
- 46:41And it's like an interesting entry would just be to recreate that.
- 46:46Like if you recreated GitHub issues in a table and it looked really spot on, that's like its
- 46:52own kind of special accomplishment.
- 46:55Like, and I think those entries are fun to see like someone recreate an existing thing in great tables or something else.
- 47:02So that, so yeah, to your point on data, I think you could start with even not having to find interesting data, but find an interesting table out in the wild and just try to recreate it.
- 47:12Yeah.
- 47:13So I don't know if this has anything to do with your contest or not, but let me suggest an interesting angle to this in terms of like competitions for this or just broadly for people who are listening.
- 47:23One is I've got really interesting data.
- 47:24I have a story to tell and let me try to like really inspire you with my custom story.
- 47:29You know, if you look at racing, like specifically auto racing, we've got F1 where everyone designs their own car.
- 47:36There are some rules, but they kind of, they all have a thousand or 500 people that work on it.
- 47:40Then you've got spec racing series, like Indy, where everyone has the same car, the same engine, or there's two choices, whatever, same thing.
- 47:47And then they compete.
- 47:48So it would be interesting to have a category that is like, this is the data.
- 47:52You have to work with this, but tell a story.
- 47:54Like who could tell the story the most interesting with like the same data, which sounds a little bit Kaggle-like, I suppose.
- 48:00Yeah.
- 48:01Or Tidy.
- 48:02Have you seen Tidy Tuesday?
- 48:03Tidy Tuesday?
- 48:04Yeah.
- 48:05Tidy Tuesday.
- 48:06I think it's exactly what you're describing.
- 48:07Every Tuesday they release a data set.
- 48:09Yeah.
- 48:10And then people, oh, wow.
- 48:12It's very, there's a GitHub repo somewhere where they.
- 48:16Yeah.
- 48:17If you search for Tidy Tuesday GitHub, you'll definitely find it.
- 48:19But essentially, yeah, it's just like data and you're, you left your own devices about how to present it.
- 48:24It could be tables, plots, anything.
- 48:26Yeah.
- 48:27I'm surprised the big Tidy Tuesdays, it's kind of a tricky one.
- 48:30There's a, I think there's a Tidy Tuesday organization, but yeah, same data and yeah, people analyze it and then they share it out on socials.
- 48:39Yeah.
- 48:40So you get to, I think exactly to your point, like you start from the same place and you see where people get to.
- 48:45And I know like one R user, Dave Robynson for a long time, would screencast himself live analyzing for an hour.
- 48:52Oh, wow.
- 48:53Okay.
- 48:54So he plots like, what does it look like for someone to analyze the data?
- 48:57And I think that's, that's a fun dimension too, that you don't see often.
- 49:01Like just how does it unfold?
- 49:03Like, right.
- 49:03What point does he plot?
- 49:05And when does he go backwards?
- 49:06It's like the Bob Ross of, of tables, you know, like the happy little trees come first and then this and that, oh, that's how you make that picture.
- 49:15Okay.
- 49:15Right.
- 49:15It does take time.
- 49:16Yeah.
- 49:17I mean, like just yesterday I was making new examples.
- 49:19I'm not surprised how long it takes to make a compelling example for a table.
- 49:22It's like, thanks time.
- 49:23You have to mess with the data.
- 49:25Yeah.
- 49:25And I will say this, this coffee table example that Marco pointed out.
- 49:30So the coffee table example for people listening is, it's an example table we created where every row is a like coffee device.
- 49:39So it's the idea of this table is for like a fictional coffee device shop and every row is a coffee device.
- 49:46And then there are columns on like, oh, how many did we sell?
- 49:50How much profit did we make?
- 49:52And then there's a nice little, there's a column that's little bar charts, that show the monthly sales broken down.
- 50:00try hovering over one of those bars.
- 50:02Yeah.
- 50:03Yeah.
- 50:03Yeah.
- 50:03Yeah.
- 50:03So this is one of the things I wanted to make sure that we got a chance to talk about, because this is, we've talked about having images in here, which is great.
- 50:11And the, what is this thing called?
- 50:14That this group spanner, I can only think splitter.
- 50:17I'm like, no, it's not the spanners and the colors and stuff there, but then you have what in the framework referred to as nano plots.
- 50:26Yeah.
- 50:26Right.
- 50:27So that we already saw the bar graph, but that was just an example, but here we've got like a little bar chart.
- 50:32And Rich, as you point out, as I interact with it, it's, it's like a little plotly type thing.
- 50:36Like if I had, if I were real young and my eyes were real good, I could read that.
- 50:40Well, they're very small, but you have very low space.
- 50:45So like, I mean, they're nano size.
- 50:47That's why they're nano size.
- 50:48They're not even micro plots.
- 50:49They're just nano plots.
- 50:50Exactly.
- 50:51But yeah.
- 50:51That's all we got here.
- 50:52They're meant for HTML and meant to be lightweight, slightly interactive.
- 50:56Just to give you a little something, you know, to, to mouse over and to, to drill down.
- 51:01Massively important because it shows you it's, I had Stephanie, Stephanie Molin on a little
- 51:09while ago and she has this project that sort of, if you want the same information about the
- 51:14statistical summary of some set of data, like the standard distribution, the mean, the max,
- 51:20the min, and it could be like one little blob or she has this thing, it'll animate it into
- 51:25like a kangaroo or something.
- 51:26And then it's, it's got all the same information.
- 51:28You have the same problem with tables here, right?
- 51:30Like the total amount sold, the percent sold.
- 51:32But if you look at the nano plots, some of them are really spotty and some of them are
- 51:38pretty much flat and that it tells you a whole nother dimension.
- 51:41That's kind of, this is kind of what I was getting at.
- 51:43Like you could make this multi-dimensional and that that's another piece of communication
- 51:47that isn't just, you know, rows and columns.
- 51:50Yeah.
- 51:50It's a nice conversation too, because each of those bars could variable be a column, right?
- 51:54I can have like a January column all the way up to.
- 51:56Yeah, exactly.
- 51:57Yeah.
- 51:57So it just shrinks it down.
- 51:59And it's useful.
- 52:00So you're having a table and a plot and you got to like jump back and forth.
- 52:03Like it's, it emerges these two ideas in a pretty cool way.
- 52:06Yeah.
- 52:06Sort of explain the difference between tables and plots.
- 52:09I like too, that with the nano plots, like these little bar charts, maybe their job, like
- 52:14in a lot of tables, their job is to focus you onto a row.
- 52:17Like if you notice that pattern's interesting, it pulls you onto that record, that row.
- 52:22And then that lets you visit other columns to see like supplemental information that maybe
- 52:28suggests what could be happening or like gives you information to look up more as you're doing
- 52:33an analysis.
- 52:33So it's kind of a neat, like visual pattern as a way to index onto interesting cases.
- 52:39And then table columns have the power to give you more information about these cases.
- 52:44Yeah, that's cool.
- 52:45It seems like because you can put markdown into these pieces as well, you could have them
- 52:50maybe jump to the full size plot or something more, more rich as you want to kind of expand
- 52:55a row or something.
- 52:56Yeah, totally.
- 52:57I think there are interactive table libraries too.
- 53:01So one we have ported to Python recently is called Reactable.
- 53:05So we made a port called ReactablePy that it offers expanding tables.
- 53:10So if you're interested in a row, you can click it to expand down, say like more information
- 53:17or even a lot of like detail and description.
- 53:21But I think to your point, yeah, that's a really neat possibility of being able to like
- 53:25click and either be taken somewhere or have the table like open up.
- 53:30And yeah, that would be cool to have an inline capability.
- 53:33Yeah, I do.
- 53:35I do want to note one thing about this table that I think about a lot is we I'm so glad that
- 53:40Marco brought up.
- 53:40It was useful because we spent a long time.
- 53:43We spent, I think, a couple of weeks creating this table.
- 53:46And I talk about this with open source developers sometimes that I think about this, like how
- 53:53long we spent on this table, because this table's job was to illustrate like structuring, formatting
- 53:59and styling in like what should be like your first encounter with great tables.
- 54:05And so we really, in a sense, as we created this table, we were on the hunt for a table that
- 54:10both introduced people to a range of activities, like looked nice, but also had code that we
- 54:17could explain.
- 54:18And I it's like so hard.
- 54:20I feel like as open source maintainers sometimes to find that like right example, like compelling
- 54:26shows off like a range of activities, but also is approachable.
- 54:31And I do remember like Marco, one thing that opened my eyes is he, I think he shared this
- 54:35table on LinkedIn once, but he shortened it to like three or four rows.
- 54:39And that I'm always really interested in seeing those types of activities because I think that
- 54:44post really took off.
- 54:46And it, I don't know, it always like teaches me the power and the value of really like getting
- 54:52an example down and getting it.
- 54:55So it's interesting, but also like short and compact is like such a art that some people
- 55:00are so good at.
- 55:01Yeah.
- 55:01It's, it's very cool.
- 55:02We don't have much time left.
- 55:03So I want to focus on the last bit of this journey that data goes through great tables.
- 55:09And that is what happens, where does it go at the end?
- 55:12You know, like what can I export?
- 55:15Yeah.
- 55:16So we talked about HTML and this interactive bit, but what are the different places that you
- 55:22could send this to?
- 55:23Well, I think the big ones are notebook.
- 55:24You're just iterating through some data and you want a table.
- 55:27Maybe you want to present that as well.
- 55:28So notebook is like a really good example.
- 55:30So maybe you put that actually just in a cell and just as part of the notebook, it just runs
- 55:35there.
- 55:35Yeah.
- 55:35That's right.
- 55:36That's right.
- 55:36And another one is just like, you want it somewhere else and maybe you want it in a presentation.
- 55:40You want a graphic.
- 55:41So we have a facility for that.
- 55:42It's the save method.
- 55:43We just like you get a image file or even a PDF from the table.
- 55:47And sometimes you just want to take that HTML and run with it somewhere else, maybe embedded somewhere,
- 55:51maybe put it inside of an email.
- 55:52So we have an as raw HTML method, which gives you an HTML string that you can just like pop
- 55:58in somewhere else.
- 55:59Nice.
- 55:59And does that just give you like the worst possible HTML in the sense that like everything that
- 56:05has a color has a style set straight on it and stuff like that?
- 56:08You have two different stages.
- 56:10You can have it like the style block, sort of like as a one div with the table and the
- 56:14style block embedded.
- 56:16Or you can have all the styles in line, which is a new feature, which is actually useful for
- 56:19emails.
- 56:19Yeah, exactly.
- 56:21Because as much as you want to write nice stuff, we can't have nice things because a lot of
- 56:26the email clients forbid you from putting styles in there.
- 56:28It's most notably Gmail.
- 56:30If you put a style, even a solid style block, it'll just throw it away.
- 56:34So you've got to just jam it onto everything.
- 56:36If that thing can be bold, it's in a span and it has, you know, style, font weight bold
- 56:40on it, you know?
- 56:41When I first learned of that like years ago, because I'm in the email game as well.
- 56:44I was like, really?
- 56:45How does this exist in this year?
- 56:48But it does.
- 56:49It still exists because of certain clients.
- 56:52So, yeah, but luckily there's lots of like great, and we have it here too, but there's
- 56:55lots of people who have developed libraries to inline CSS into tags.
- 56:59Yeah.
- 57:00Yeah.
- 57:00That's the right purpose.
- 57:02I guess one more output, sorry, is a little attack, right?
- 57:07Yeah.
- 57:07As the final destination.
- 57:08Yeah.
- 57:09That's a new thing.
- 57:10So if you're running a paper, you want a table in it, we now have some way to get the
- 57:14table in attack.
- 57:15If you want your academic paper or your dissertation to have it, like, in it goes.
- 57:19Yeah.
- 57:20Sorry, Michael, what were you going to say?
- 57:21Oh, no, I think one interesting thing too, is I think .show, we have a really great contributor,
- 57:26Ju Young, that prompted this.
- 57:29I think because he was teaching a workshop to vision impaired, like data scientists.
- 57:35And so .show is handy to be able to call .show and have it open a browser with the table, I
- 57:40think was like really useful.
- 57:42And that was so helpful to have as a issue.
- 57:45And I think that contribution to GreatTable is really huge.
- 57:50Yeah.
- 57:51Yeah.
- 57:51Because then a screen reader could read it.
- 57:53Exactly.
- 57:54Yeah.
- 57:54Yeah.
- 57:54Yeah.
- 57:55Facility for that.
- 57:55But also it's kind of disappointing to work in the console and not have anything being shown.
- 58:00It's like, what?
- 58:01Yeah.
- 58:02So that's really good.
- 58:04And I see Carol noted Quarto, which is actually the whole GreatTable's website is built with
- 58:09Quarto.
- 58:10Quarto.
- 58:11And that's a nice format.
- 58:12And that's a nice format.
- 58:13So it uses a file called a QMD, which is a lot like Markdown, but it can run the code.
- 58:19And Quarto is really convenient for building things like websites or HTML reports.
- 58:23And it's also developed by Posit.
- 58:25But we, yeah, we end up putting tables a lot in like Quarto documents or the like Great Tables
- 58:32website.
- 58:32Yeah.
- 58:33Through Quarto.
- 58:34And maybe he's too bashful to mention it, but he developed like the library Quarto doc,
- 58:37which makes this site possible and makes those tables rendered.
- 58:41Oh, that's awesome.
- 58:42Like Michael.
- 58:42That is.
- 58:42Oh, yeah.
- 58:43I guess for context.
- 58:44So like some tools like IBIS, their API docs and the Great Tables docs.
- 58:49Yeah.
- 58:50We just created a small tool called Quarto doc to let them put their like API references in
- 58:56these websites so they can use Quarto.
- 58:57Yeah.
- 58:58That's excellent.
- 58:58Yeah.
- 58:59Very, very cool.
- 58:59All right.
- 59:00Well, I think we're pretty much out of time.
- 59:03I guess give people a sense of where you're going, like roadmap type stuff.
- 59:07Is anything they should be looking out for?
- 59:09Yeah.
- 59:10I think we want to port quite a bit more from the R program over to Great Tables.
- 59:14That includes things like merging, concatenating values from different columns into single columns.
- 59:18Things like adding footnotes to tables.
- 59:21So the footer is more put to better use.
- 59:24And more refinements to formatters and additional formatters.
- 59:27There's quite a few more things to go.
- 59:29But even right now, it's pretty mature.
- 59:32But there's probably things people will ask for that I haven't thought of.
- 59:35So that's the nature of the game.
- 59:36I think Anon is asking for Excel.
- 59:38We'll put Excel in there, you know?
- 59:40Yeah.
- 59:41Yeah, I'll get to that.
- 59:42The snake will eat its own tail.
- 59:43Excel's a big one.
- 59:46We'll put Great Tables in Excel so you can just go all the way to the bottom, wherever that is.
- 59:51Well, I think one other thing to note is extensions that in R, tons of people have extended GT, the Great Tables for R.
- 59:59And tons of helper packages.
- 1:00:01Like if putting a bar in your table is something you want to do, there are a lot of these inside extra helper packages.
- 1:00:09And so I think one nice thing would be we want to kind of create a example helper package just to give a feel for how people in Python could also create this kind of stuff for Great Tables.
- 1:00:20If you want to extend like, yeah, if you wanted to create your own little bar charts in Great Tables, it seems like people have done a lot of that in R.
- 1:00:30And so it'd be cool to try to foster that kind of ecosystem and extension.
- 1:00:34Absolutely.
- 1:00:35Yeah, that's awesome.
- 1:00:36All right.
- 1:00:36Well, I'm going to leave everybody with one parting thought, and then I'll let you guys give a final call to action.
- 1:00:43You're looking at some of these examples, especially those 10 ones that you called out, Rich, that I'll link in the show notes.
- 1:00:50If you're doing a presentation to your company on your blog as a data scientist or just generally, it's so easy, I think, to just have the tables and then maybe somewhere you have a picture or something.
- 1:01:03But if you put something together like that, that will get people's attention straight away, right?
- 1:01:07It's just really another level of production.
- 1:01:11And the fact that you do it with Python means it's reproducible.
- 1:01:14You do it once and off it goes.
- 1:01:16Like that's pretty excellent.
- 1:01:17So if that sounds like something you all do, you should check out Great Tables.
- 1:01:20It looks pretty excellent.
- 1:01:21All right.
- 1:01:22Michael, give a final call to action.
- 1:01:25People wanting to get started with Great Tables, what do you tell them?
- 1:01:27You know what?
- 1:01:28Visit Great Tables, probably on GitHub.
- 1:01:31Check out the examples.
- 1:01:34I think the examples are such a helpful way to get started.
- 1:01:37And then if you get any questions at all, we have a Discord or we love hearing from people in the issues.
- 1:01:44You know, we want to hear from you.
- 1:01:45Read it all.
- 1:01:46We consider it pretty, you know, pretty carefully.
- 1:01:48Not carefully, but we want to do people.
- 1:01:50Like style pays.
- 1:01:52Like you just got to churn out those beautiful tables.
- 1:01:55You know, there's no other choice.
- 1:01:57That's right.
- 1:01:58I think also once you set up one of them, if you kind of do similar types of tables, like you can reuse that code in a lot of ways.
- 1:02:06So unlike doing a design or something.
- 1:02:09All right, Rich, final word.
- 1:02:11Final word.
- 1:02:11Contribute.
- 1:02:13Like if you want more of a call to action, just get into the site, discuss things with us.
- 1:02:18Even if your idea is like way in left field, we'll probably consider it and maybe even do it.
- 1:02:22That's how eager we are to please when it comes to tables.
- 1:02:26Awesome.
- 1:02:26So PRs are accepted.
- 1:02:27PRs, anything.
- 1:02:28Issues, complaints, whatever.
- 1:02:30Beautiful.
- 1:02:32All right.
- 1:02:33Thanks for coming on the show, guys.
- 1:02:34Yeah.
- 1:02:35Thanks for having us.
- 1:02:36Yeah.
- 1:02:36Congrats on the project.
- 1:02:37See you later.
- 1:02:37See you.
- 1:02:38This has been another episode of Talk Python To Me.
- 1:02:42Thank you to our sponsors.
- 1:02:43Be sure to check out what they're offering.
- 1:02:45It really helps support the show.
- 1:02:46This episode is sponsored by Posit Connect from the makers of Shiny.
- 1:02:51Publish, share, and deploy all of your data projects that you're creating using Python.
- 1:02:55Streamlit, Dash, Shiny, Bokeh, FastAPI, Flask, Quarto, Reports, Dashboards, and APIs.
- 1:03:02Posit Connect supports all of them.
- 1:03:04Try Posit Connect for free.
- 1:03:06By going to talkpython.fm/posit.
- 1:03:09P-O-S-I-T.
- 1:03:11Want to level up your Python?
- 1:03:12We have one of the largest catalogs of Python video courses over at Talk Python.
- 1:03:16Our content ranges from true beginners to deeply advanced topics like memory and async.
- 1:03:21And best of all, there's not a subscription in sight.
- 1:03:24Check it out for yourself at training.talkpython.fm.
- 1:03:27Be sure to subscribe to the show.
- 1:03:28Be sure to subscribe to the show.
- 1:03:29Open your favorite podcast app and search for Python.
- 1:03:32We should be right at the top.
- 1:03:33You can also find the iTunes feed at /itunes, the Google Play feed at /play, and the direct
- 1:03:39RSS feed at /rss on talkpython.fm.
- 1:03:43We're live streaming most of our recordings these days.
- 1:03:45If you want to be part of the show and have your comments featured on the air, be sure to
- 1:03:49subscribe to our YouTube channel at talkpython.fm/youtube.
- 1:03:54This is your host, Michael Kennedy.
- 1:03:55Thanks so much for listening.
- 1:03:56I really appreciate it.
- 1:03:58Now get out there and write some Python code.
- 1:03:59Bye.
- 1:04:00Bye.
- 1:04:01Bye.
- 1:04:02Bye.
- 1:04:03Bye.
- 1:04:04Bye.
- 1:04:05Bye.
- 1:04:06Bye.
- 1:04:07Bye.
- 1:04:08Bye.
- 1:04:09Bye.
- 1:04:10Bye.
- 1:04:11Bye.
- 1:04:12Bye.
- 1:04:13Bye.
- 1:04:14Bye.
- 1:04:15Bye.
- 1:04:16you
- 1:04:17Thank you.