Practical Python Data Visualization: A Fast Track Approach To Learning Data Visualization With Python - podcast episode cover

Practical Python Data Visualization: A Fast Track Approach To Learning Data Visualization With Python

May 15, 202516 min
--:--
--:--
Download Metacast podcast app
Listen to this episode in Metacast mobile app
Don't just listen to podcasts. Learn from them with transcripts, summaries, and chapters for every episode. Skim, search, and bookmark insights. Learn more

Episode description

It functions as an introductory guide to data visualization using Python. The Book cover fundamental Python concepts, the Jupyter Notebook environment, and several data visualization libraries, including leather, NumPy, Matplotlib, and pandas. Topics range from basic Python syntax and installation to creating various chart types, handling image data, visualizing graphs, and working with structured data formats like pandas DataFrames, all aimed at equipping readers with practical skills in displaying and interpreting data visually.

You can listen and download our episodes for free on more than 10 different platforms:
https://linktr.ee/cyber_security_summary

Get the Book now from Amazon:
https://www.amazon.com/Practical-Python-Data-Visualization-Approach/dp/1484264541?&linkCode=ll1&tag=cvthunderx-20&linkId=bc67d4571a73f51f7c2f9bf7f973f31c&language=en_US&ref_=as_li_ss_tl


Discover our free courses in tech and cybersecurity, Start learning today:
https://linktr.ee/cybercode_academy

Transcript

Speaker 1

Welcome to the deep dive, where we take your chosen sources and well distill them down to the essential insights. Right. Think of us as your shirt cut to understanding what really matters.

Speaker 2

Yeah, cutting through the noise.

Speaker 1

Today we're plunging into the world of Python data visualization, guided by Ashwun Pajankar's book Practical Python Data Visualization, specifically for.

Speaker 2

You, the learner, exactly, the learner, someone looking for that efficient path to knowledge, those aha moments without getting you know, bogged down. So our mission today is to explore pajon Car's book, focusing on how it gets you from zero to visualizing data effectively in Python. Okay, we'll be highlighting the key concepts and practical steps from those initial chapters.

Speaker 1

Okay, so where does pajon Car start. It's got to be the foundation Python itself, right, yep? Chapter one. Now Python's been around for a while, hasn't it. The book mentions Guido van Rossum created it building on an older language called ABC. That's right, first version way back in ninety one. And it's interesting they even retired Python too fairly recently. Shows it's still evolving.

Speaker 2

Yeah, constantly. And what's fascinating about that evolution are the Python Enhancement Proposals or PEPs PEPs okay. I think of these as community driven proposals for how Python should grow and improve. Pajankar highlights PK twenty The Zen of Python.

Speaker 1

Ah, The Zen of Python. I love that. It's almost like a philosophy for coders. It really is principles like beautiful is better than ugly and readability counts. You might think, Okay, how does that relate to making charts, But it really does, doesn't it clear, Well written code just makes the whole visualization process.

Speaker 2

Smoother, absolutely easier to understand later easier to fix. These principles are fundamental to why Python is so well user friendly and why it's become such a go to language across so many fields. The book touches on this diversity, web development, gui's scientific, computing.

Speaker 1

Even system administration.

Speaker 2

Right includes a link to Python success stories, which really illustrates just how widely it's used to solve real world problems.

Speaker 1

So you could be visualizing I don't know, financial.

Speaker 2

Trends or or mapping information spread It's incredibly versatile.

Speaker 1

Now for actually getting Python onto your computer, the book walks through installation for different systems. For Windows, it involves downloading from python dot org. And this is important, making sure you add Python to your path. Ah.

Speaker 2

Yes, the path variable crucial.

Speaker 1

It basically tells your computer where to find pythons so you can run it from the command line. Then you verify it with Python dash V and PIP three dash v. That PIP three is your package installer, right, we'll need that.

Speaker 2

Definitely for installing all the visualization libraries later. And for Linux users like Ubuntu, Pujankar notes Python three and PIP three are often already installed.

Speaker 1

Convenient.

Speaker 2

Yeah, just check with Python three dash V and PIP three dash V. Knowing you have those tools ready is step one.

Speaker 1

Okay, tools ready. Then Pagencar introduces Python's different modes. There's interactive mode.

Speaker 2

Where you type code get instant results good for quick tests.

Speaker 1

And script mode where you save your code and dot wi files to run later more for actual programs exactly.

Speaker 2

He also mentions IDL, which comes with Python.

Speaker 1

Right, the Integrated Development and Learning Environment.

Speaker 2

A simple editor to start writing and running. Python works on Windows and Linux, and he shows.

Speaker 1

That classic Hello World example. In both modes. It's a small thing, but getting that first program to run always feels good.

Speaker 2

It does that solid Python foundation, then leads us straight into chapter two and Jupiter Notebook.

Speaker 1

Ah, Jupiter, okay, so way Jupiter. What's the advantage over just the basic interactive mode.

Speaker 2

Well, if you've ever been frustrated running code line by line and you make a mistake and can't easily go back, or you want to save your results with the code, Jupiter is a game.

Speaker 1

Changer, right. It fixes those issues.

Speaker 2

The gen car describes it as a server program. You run it and it lets you create these interactive notebooks right in your web browser. Okay, in the browser interesting hugely popular in research and data science because you can mix your code the output, charts and tables, and even text explanations all in one document.

Speaker 1

So it's like a dynamic report where the analysis and results live together.

Speaker 2

Precisely. Setting it up is pretty straightforward. PIP three Install.

Speaker 1

Jupiter using that PIT three again.

Speaker 2

Yep. Then you launch it from your command line with jupi notebook. It usually pops open in your browser at localhost dot eight eight eight eight.

Speaker 1

And there's sometimes a token.

Speaker 2

Yeah, Pajuancar mentions the token it's just a security measure. Make sure only you access your notebooks. Nothing to worry about usually gotcha.

Speaker 1

He gives a quick tour of the interface too.

Speaker 2

He does the files tab for navigating, running tab to see active notebooks, clusters for more advanced stuff.

Speaker 1

But the core is creating a new Python three notebook.

Speaker 2

Right and inside that you have these things.

Speaker 1

Called cells cells. Yeah, I remember first using those. It felt much more organized for trying.

Speaker 2

Things out, definitely, And Pajankar points out the different types code cells for your Python and markdown.

Speaker 1

Cell arcdown for formatting text.

Speaker 2

Exactly, for adding headings, notes, lists, making your notebook readable. He shows a quick example, and these notebooks save as ipomanbi files.

Speaker 1

Dot ipmb okay keeps everything for.

Speaker 2

A project together exactly, code, output, notes all in one place.

Speaker 1

Okay, so we have Python setup, we have this interactive Jupiter environment. Chapter three must be where the visualization starts, right.

Speaker 2

It is first taste of visualization with a library called Leather.

Speaker 1

Leather never heard of it.

Speaker 2

Pajancar introduces it as a really user friendly way to make basic charts quickly, simple syntax.

Speaker 1

How do you get it?

Speaker 2

You guessed it? PIP three install Leather huh? Okay, and what's neat here is. Pajankar shows you can run operating system commands directly from inside Jupiter using an exclamation mark before the command. So you could do dot PIP three, install leather, write in a cell or dull less to list files. Pretty handy.

Speaker 1

That is handy, let's jump around. He also mentions indentation right, that's super important in Python, crucial.

Speaker 2

He highlights it specifically. Unlike languages using curly braces, Python uses white space indentation to structure cod blocks.

Speaker 1

So it's not just for looks. It actually tells Python how the code fits together exactly.

Speaker 2

Get it wrong, you get errors.

Speaker 1

Good warning. Okay. So plotting with letter how does that work?

Speaker 2

The Junker demonstrates defining your data points and Leather is quite flexible. Accepts data in a few formats like lists of pairs.

Speaker 1

Okay.

Speaker 2

Then you create a chart object. Then you add things to it like dots using chart dot ad dots makes sense. Finally, to see it or save it, you use chart dot to SVG. It outputs a scalable mector graphic file SVG.

Speaker 1

Okay, so it's a pretty direct path. Uh, data chart object ad elements output very direct.

Speaker 2

He also shows tweaking the look, dot color size, and plotting multiple sets of data on one chart.

Speaker 1

Does leather handle colors automatically for multiple sets?

Speaker 2

It does? Yeah, picks different default colors which helps distinguish them.

Speaker 1

Nice. What else can leather do besides dots?

Speaker 2

Pajunkar introduces lines with adline bar charts with AD bars good for text categories, and column charts with AD columns.

Speaker 1

So the basic chart types.

Speaker 2

The fundamentals, Yeah, and shows simple ways to customize those two.

Speaker 1

What about axes and scales as leather handled that it does?

Speaker 2

He explains, it automatically figures out the right scale ordinal for text, linear for numbers, temporal for dates, but you can also manually set limits if you need more control, say for the II axis range.

Speaker 1

Okay, any other styling.

Speaker 2

The chapter wraps up touching on styling options, setting specific tick values on axes, changing the overall look with themes via leather dot theme themes okay, and even a cool example of making data point colors change based on their position using a custom function, a little touch of dynamic viz.

Speaker 1

Wow. Okay, So leather seems like a good starting point for simple stuff.

Speaker 2

That's the takeaway. Great entry point. But as Pajenkra points out, for more complex, highly customized charts, you'll need the broader scientific Python ecosystem.

Speaker 1

Which brings us it chapter four the Powerhouse chapter exactly.

Speaker 2

Chapter four introduces the SCIPI ecosystem. It's this collection of libraries built for math, science, engineering, and Python.

Speaker 1

Okay, so what's in this ecosystem.

Speaker 2

Pajenkra lists the core players, Python itself obviously, numb PI for numerical computing NUMBPI.

Speaker 1

Heard a lot about that one.

Speaker 2

The SIPE library itself, which has tons of mathematical routines, and matt plotlib for more advanced plotting matte plotlib.

Speaker 1

Okay, so that's the step up from Letter definitely.

Speaker 2

He also mentions other key libraries pandas for data analysis.

Speaker 1

Like working with tables, ah Pantas.

Speaker 2

SIMPI for symbolic math, psychic image for image processing, psyche learn for machine learning. It's a whole toolkit.

Speaker 1

Wow. Quite the ecosystem, and.

Speaker 2

He reminds us Jupiter notebook is often the interactive environment where you use all these together.

Speaker 1

Makes sense, So the chapter dies into numb PI.

Speaker 2

It focuses on numb PI and its core data structure. The underay n dimensional array deray.

Speaker 1

What is that exactly?

Speaker 2

Pajunker explains, it's like a super efficient container for numerical data. Importantly, all items in an under ray have the same data.

Speaker 1

Type, ah, same type. Why is that important?

Speaker 2

Speed? Yeah, That uniformity makes calculations incredibly fast compared to standard Python lists.

Speaker 1

Got it? How do you make one?

Speaker 2

He shows creating them from Python lists using np dot array. You can also specify the data type using d.

Speaker 1

Type okay, and accessing.

Speaker 2

Elements standard indexing using square brackets, both positive indices starting from zero and negative indices counting from the end, like.

Speaker 1

Myra's eer for the first, myra one for the last.

Speaker 2

Exactly, and he points out, try to access something that isn't there, you get an index error.

Speaker 1

Good to know. What about more dimensions like tables?

Speaker 2

Yet he moves on to two d arrays like matrices or tables, and even three d arrays. Shows how indexing works there too, to get specific elements or entire rows or.

Speaker 1

Columns, slicing and dicing the data.

Speaker 2

Pretty much. That ability to sele elect and manipulate parts of your data easily is a key numb Pie strength.

Speaker 1

What else about injuries properties.

Speaker 2

Briefly runs through useful properties indem for number of dimensions, shape for the size of each.

Speaker 1

Dimension like rows and columns in two D, right.

Speaker 2

D type for the data type again, size for total elements, invites for memory usage, and t for the.

Speaker 1

Transpos transpose flips, rose and columns.

Speaker 2

Yep, just useful ways to understand the structure of your array.

Speaker 1

Anything else in the numpie chapter.

Speaker 2

It finishes by listing some handy built in NUMPI constants np dot an f or infinity, np dot n n n for not a number.

Speaker 1

You see nana lot in real data.

Speaker 2

Very common and mathematical constants like np dot t i and npe useful for calculation.

Speaker 1

Okay, so chapter four gives us numb Pi for handling the numbers efficiently. Chapter five must be putting it together with mattplotlib for visualization.

Speaker 2

You got it. Chapter five data visualization with numb Pi and matt Plotlib.

Speaker 1

Finally, Matt plotlip.

Speaker 2

Pajanker introduces it as a fundamental plotting library in the siepi world. Actually inspired by Matt Labs plotting.

Speaker 1

Ah.

Speaker 2

Okay, installation kit three, install matt plotlib standard stuff and using it in code typically import mattplotlib dot pieplot as PLTKA. Giving it that short name PLT is convention. And if you're in Jupiter, that magic command percent matt plotlib inline is key.

Speaker 1

What that again tells.

Speaker 2

Jupiter to display your plots right there in the notebook output below the code cell very convenient.

Speaker 1

Right and import numpi two.

Speaker 2

Oh yeah important NumPy as np. Mattplotlib works hand in glove with numpi erase.

Speaker 1

Okay, Import's done. How do we create data to plot? He mentioned numpike creation routines.

Speaker 2

He did first up is np dot arrange creates evenly spaced numbers and arrange like.

Speaker 1

Zero, one, two three or zero point five to one point zero exactly.

Speaker 2

You have to give it the stop value, but start and step size are optional. He shows examples, including making x values for a simple y x plot.

Speaker 1

Okay, arrange what else np.

Speaker 2

Dot limb space similar, but instead of step size you give it start, stop and how many points you want in between evenly spaced ah.

Speaker 1

Useful if you need exactly, say, one hundred points across a range precisely.

Speaker 2

Pudge on car shows an example, and how to turn off plot axes with plt dot axsis just to see the generated.

Speaker 1

Points interesting any others.

Speaker 2

Briefly mentions np dot log space and np dot gm space for logarithmically or geometrically spaced values. Useful for certain plots like log scales, shows their output visually.

Speaker 1

Good to know they exist. So we have data, How do we plot it?

Speaker 2

The core function is PLT dot plot. He shows using it with both Python lists and numbpi arrays to create single line plots. Demonstrates a simple curve while by two.

Speaker 1

Okay, PLT dot plot. How about multiple lines on one chart?

Speaker 2

Two ways either call plt dot plot multiple times for each line, or you can sometimes provide multiple y value rays to a single PLT dot plot. Mattplot lib handles the different colors automatically.

Speaker 1

Nice, But plots need labels and stuff right absolutely.

Speaker 2

Pa gen car covers the essentials adding a grid PLT dot grid true. Saving the plot PLT dot save fig, myplot dot png.

Speaker 1

Save fig important. What about axis limits.

Speaker 2

PLT dot axis for setting all limits at once, or p l t dot XLM and p lt dot XLM for individual control over the x and y ranges. Good titles and axis labels PLT dot title p l T dot rabel and p l T dot label really crucial for making plots understandable.

Speaker 1

Definitely need those. What about legends If you have multiple lines.

Speaker 2

Use the label argument inside p l T dot plot for each line like p l T dot plot x y one label data set one, then call PLT dot legend to display it, and.

Speaker 1

You can control where the legend appears.

Speaker 2

Using the lock argument in PLT dot legend like upper left or best to let matplot lib decide.

Speaker 1

Okay, making it informative, Now making it look good.

Speaker 2

Colors lines big part of chapter five. He details changing colors with short codes like R for red, G, green, b blue, simple codes, changing line styles solid, dah, dash, dash, dash, dot is, adding markers to data points, et cetera. Lots of options. You can combine these format strings like row for red, circle markers dash line.

Speaker 1

Combines color marker and lin style.

Speaker 2

Hmm efficient Yeah. And then he shows more detailed control using keyword arguments in PLT dot plot like what things like colored red line style dashed line with two marcro markerface color blue marker size ten, much finer control.

Speaker 1

Wow, lots of options there. Anything else on customization.

Speaker 2

Finishes with customizing the tick marks the actual number shown on the axes. Using PLT dot x sticks and PLT dot tics, you can set the positions and even the labels for the ticks.

Speaker 1

So really fine grain control over how the axes look exactly.

Speaker 2

Matt plotlib gives you that power building on NUMPI data.

Speaker 1

So looking back at these initial chapters of practical Python data visualization, we've covered quite a bit of ground.

Speaker 2

We really have, from just getting Python running, setting up that interactive Jupiter environment, yeah, to a first taste of plotting with leather, and then diving into the core tools numbpi for the numbers and matt plotlib for them the pictures.

Speaker 1

Absolutely, and it's quite striking how even these early chapters give you a solid toolkit. You're not just looking at data, you're equipped to actually bring into life visually.

Speaker 2

Going from raw numbers to creating and customizing fundamental charts. It's a powerful first step.

Speaker 1

It really makes you think, doesn't it. How could this ability, even with these basic forms of visualization, change how you understand or communicate information in your own field?

Speaker 2

Yeah? Consider the data you see regularly, could using PLT dot plot or even simple leather charts reveal patterns or insights you just haven't noticed before. Turning numbers into stories.

Speaker 1

Definitely food for thought, and as pajunker shows, there are pathways for going Deever, those PEP docs, the full map plot lib documentation.

Speaker 2

You mentioned, there's a whole universe of more advanced techniques, different libraries, specialized charts out there.

Speaker 1

Perhaps in future deep dives we could explore some of those more advanced tools or look at specific real world applications.

Speaker 2

That'll be interesting. The possibility to these with Python visualization are well pretty exciting.

Transcript source: Provided by creator in RSS feed: download file
For the best experience, listen in Metacast app for iOS or Android