1. Home
  2. Explore
  3. Computer Science
  4. Data Visualization with Pandas and Plotly

Study methods

Flashcards
Quiz
Fill in the blanks
Written test
Lesson
Notes
Podcast
Content

Data Visualization with Pandas and Plotly

Transcript

so hi everyone thanks for joining uh my name is nathan puccini i am one of the marketing manager managers at data data science dojo and today i have greg camrad with us and he is um the founder of dataindependent.com and i think you're also a data analyst or a senior analyst or you work with data professionally for a living is what i'll say um and you're going to be giving us a crash course on data visualization you know you're going to tell a story with your data

and i think to start we're going to be going through some theory and at the end we're going to do a paired coding session with pandas and plotly so and everybody will be able to um to follow along with that we have some uh csvs and um uh slides and all of that good stuff to give to everyone so uh greg throughout your presentation whenever you want us to release that um let us know and then uh like i mentioned like a couple of minutes ago for questions please use the q a tab we're

going to try and save them all from the end um and then if you want that certificate of attendance to show to someone that you did in fact attend a data science dojo webinar um we're going to release that right before we start the q a session at the end so after the paired coding session but before we start q a i mean we'll make sure everybody has plenty of time uh to fill that out so uh with that greg why don't you go ahead and take it away and then um i'll interrupt you in case we need something cool wonderful let's jump right into it and the way i like to start my presentations uh is with a story so in 1372 we all know the tower of pisa was opened um unfortunately it would become famous for something that it would later regret right and we all know what it is the tower tips and we know this as the leaning tower of pisa now if you don't believe me let me draw some red lines on here to show you yes it is in fact sipping next to the ground now the interesting part

about this though is that the guests of the tower were making a visualization without even knowing it they were in fact helping me make this presentation right now all those hundreds of years ago and they didn't even know it but before we get started let's clear up what visualization means because that's a word with a lot of syllables and it might be scary in my view a visualization is just a very broad and fancy word for communicating a message through a visual form and that's a verbose way of saying it's really just a visual that's communicating the message for you so visualization is uh is not too scary now where does this have to be with the leaning tower of pisa well in that tower there are some beautiful beautiful marble steps and not only are these great pieces of craftsmanship but there's also a message that is being communicated to us through these steps and i was looking at this photo and i was thinking all right what message am i getting

from these steps and the immediate thing that jumped out to me were these awesome wear marks within the stairs the marble stairs themselves and i thought to myself dang that's pretty cool these wear marks are indicating where there was the most foot traffic on these steps and so it's like okay so after all these hundreds of years the marble is starting to tell us something so if we were to translate this in a bit more modern terms this foot traffic data is being communicated to us in a visual

form and using the same definition we just came up with beforehand that all that sounds awful an awful lot like a data visualization and if you don't believe me that this looks like a data visualization well let's break this down and change a little bit to add some more modern form and i'll show you so we have our steps i'm going to go ahead and i'm going to zoom in on one of these steps and then i'm going to draw a squiggly line that outlines the wear marks i'm going to throw on some axes under these steps so the y-axis is now the amount of wear that we see within this step and the x-axis is going to be the width of the step i'm going to throw on some axis labels so i know exactly what i'm looking at over here on the left is the left or most step location on the right is the rightmost and then i'm going to draw a dotted line that says hey at this line there's nowhere however if you dip down below that that's when you're going to start to see where and no good visualization we'll see is

complete without a message and so what am i trying to tell you here well pieces of steps they wear down at shoulder height or shoulder width apart and there's a little bit of emphasis to the right now most modern visualizations don't have photos so let's take that one out and then finally that squiggly line isn't dramatic enough for me so i'm going to go ahead and i'm going to exaggerate that scale a little bit more and then all of a sudden we have a data visualization derived from marble stops about the wear patterns within the stairs of the leaning tower of pisa awesome thank you for uh entertaining my story opener my name is greggy camrad and i am the founder of data independent and this is a presentation on telling stories with your data now that is a huge topic and we could go in probably a whole semester on just that but we're going to dig into the data visualization theory and practice part of it so we're going to dive into a code sample and take a look at some of this

applied here now the very first thing and the only thing if you're going to walk away with one thing today it is that the goal of a business visualization emphasis on business is to inspire action within your audience now you may look at me and say hey greg wait a minute i thought it was to make a pretty looking chart man or like hey greg i thought it was to do some really cool data science and like bring out this cool thing now in a business setting generally the data and the analytics

team are going to be helping stakeholders make a decision and you want to inspire action within your audience so i'll go as far as to say if your visualization is not creating action or making or helping a decision within your stakeholders then it may not be doing the job that you want it to be now why is this hard and why is this difficult well because visualizations are two parts and you can't really have them can't have a visualization on either of them and it is the classic almost trite example of visualizations are going to be art which is how you create your story and the message that you actually want to send to your stakeholders mixed in with the science and this is where you're going to be visually mapping quantitative information over to visual dimensions and i know that that science piece is a bit verbose but we're going to step through that and the key thing here is that you're not really able or it's very

difficult to create impact without having both of these here and so what i want to do is i want to dig into both of these first let's start off with the science piece and this is where we're going to map quantitative information numbers basically into visual dimensions and this is uh figures and shapes and charts and things that we can visually see and we're going to step through this going through a single dimension double and triple dimensions let's look at an example this will be much more clear and so what we're going to do is with this single dimension mapping we're going to start off with a quantitative piece of information and we're going to translate that over to the visual side all right so very first let's look at one dimension of a quantitative piece of information we're going to look at a single number and so this number is number 55. cool now in order to translate that number 55 into a visual dimension i have a choice how do i want to do that and well i

chose this time to have the number 55 correlate to the length of the bar that i'm showing here so this number 55 is 55 length whatever that means of this bar and that's mapping a single dimension to a single visual dimension now if that seems kind of confusing it's probably because it's so basic let's look at two dimensions which would be more clear so for two dimensions not only do i have numbers that i'm representing here but i also have separation of data points which is another

dimension showing me where the separation is and well my first dimension is going to be a number and my second dimension is going to be some aptly picked emojis to represent those so here's our quantitative information and then on the visual side we've now still kept the length of the bar is going to correlate to the number so the 55 is 55 length whatever that means 45 is in the same proportion to the 55 but a little bit shorter then you have your 25 and then you have your five

but the other dimension that we're mapping here is actually going to be the separation of these emojis and so the bar y position shows how these different data points differ from each other so the 55 is separate from the 45 as separate from the 20 is separate from the 5. cool and that's mapping two quantitative dimensions to your visual let's go ahead and look at our third example which is mapping three dimensions so for three dimensions i'm going to put together a quick table here and these

are some fictitious companies with their revenue employees and market cap completely just made up numbers and so i have three dimensions here revenue employees in market cap i'm going to skip the separation one just for clarity here and i'm going to map these over to visual now the way i chose to do this is one of my favorite charts which is a scatter plot and i'm going to translate revenue into x position so that's where it sits on that on its x-axis the employees is going to be its y position

where it sits vertically in this chart but then the cool part is that our third dimension that we're mapping is going to be the size so the market cap is correlated to the size so the lake is the biggest one and you can see tahoe here is the smallest one now just like i have in axes for my x and y i also have an axes for the side or the size so you can see here i stuck three different market caps and i probably should have put some numbers on there but i kept this more simple i'm showing that the bigger the number the bigger the market cap cool now that's mapping three dimensions quantitatively to the visual side in three visual dimensions but i found an example of a pretty crazy uh pretty crazy chart that i wanted to share now this is a chart from the new york times uh newspaper and this is new york city's weather in 2003. now the first thing i think about when i look at this is first wow that's beautiful and it's beautiful because it shows so much

information in such an elegant way but then two is like holy moly and that's a lot of that's a lot of dimensions and i tried going through and counting them and i probably did miss some but we'll see what we can count here so first off they're showing us the y on the top chart is going to be your temperature they're showing us precipitation and rainfall they're showing this a time dimension with months not only that they're going really crazy and they're using color coding to show us highs lows and ranges they're showing us days so a secondary time dimension which is pretty sweet and then they're showing us different data callouts so record rainfall or or normalized rainfall whatever that may be and so as you see here with the science side of data visualizations it's all about taking your data and mapping it to a visual dimension okay what i want to do next is i want to talk about the artistic side of creating these data visualizations and in this one we get much more uh

emphasis on presentation and storytelling now the first key part in here which is really the umbrella point that i want to communicate is you have huge flexibility in your presentations to emphasize your story and what i mean by that is you as the data analyst or you as the data person with your stakeholders there's a reason why you don't give them an excel spreadsheet and say go have fun and the reason why is because they don't want to go and read it and they want you to tell them what they

need to do so you need to summarize that uh that story and with that comes the creativity about how you're going to present that okay so in order to emphasize this what i want to do is go through a very simple exercise and what i've done here is i've done or i've created three different charts and all three of these charts show the exact same underlying data and the question is which scale is correct and when i say scale what i mean here is that the only difference between these charts is that

the y-axis has different ranges has a different scale so for example in the left-hand most chart that scale is three point nine percent to four point five percent and we're looking at conversion rates here the middle chart we have zero percent to a hundred percent and then we have zero percent to four point five percent and the big question and the one that you're going to have to answer as a data artist is really what's the correct scale and sorry to spoil it but the answer is that there is

there is no right answer and the reason why there is no right answer is because it completely depends on the story you're telling so the points that you choose to emphasize are going to depend on the message that you're trying to send and if you're going to you're going to say hey greg here's my data what's the right scale i'm going to say i've no freaking idea what what what are you trying to communicate to your stakeholder what do you want them to know about your visual uh your visual cue here i see the questions popping up i'm going to skip those for now so nathan tell me if i need to zoom in anything there so there's no right answer on this now to further emphasize that there's no right answer let's see how the narrative of your story could precipitate one of these charts so if my main message over here on the left one was man our conversion rates have grown massively well this chart is a pretty good one to show because it's really emphasizing the

gain in conversion rates and you can visually see that the middle one well i could be saying hey our conversion rates are still super super super small and if you're trying to have a conversion rate of 75 or something you may want to emphasize how you're still down at around the four percent level by visually showing the gap between your point and your 75 percent and then for the last one your message could be hey we're a long way from where we were a few months ago at zero percent conversion rate so this is really emphasizing the skip or the the the jump from zero all the way up to your four percent conversion rates awesome now in terms of things to watch out for when you're applying your artistic creativity to your charts one of those is you you don't want to overload your viz so sometimes i'll call it i'll call them novice data visualizat visualizers will overload their charts by stuffing it with a bunch of visual dimensions so not only do we

have height here we have different groups but then we have different subgroups as well and these subgroups are extremely hard to decipher and i cannot pull any message from these at all now if the subgroups aren't a part of your overall message why the heck are they in your visualization in the first place don't do it just to make yourself feel cool and like you're doing work remember you have to do this to communicate a message okay the other thing that i watch out for is going to be redundant visual dimensions that these cause confusion now redundant visual dimensions another verbose word what does this mean well it means visual dimensions that are showing the same information let's look at examples of these the very first one is going to be a very common example i see quite often and it's going to be when you're showing an area chart like you're doing right here but you'll notice that the color is the it's showing the exact same information as the y-axis

which is basically hey the further up you go on the y-axis the more the color is going to change so this color and the y-axis are showing me the same thing now it may look pretty and if your goal is to have it look pretty then mission accomplished but it's not very helpful from a business context and frankly redundant um redundant dimensions can be confusing because my mind immediately goes to okay wait what are they trying to show me with the color wait that looks like it's the same thing as the y-axis how do i reconcile these two one more example of these is going to be our uh our bar chart so you can see here again that they change the color in accordance to the bar chart position so not only does the bar length show how show the magnitude but also the color shows the magnitude as well which again is pretty but it's not uh extremely helpful uh for me right here um sweet well i tell you what that was our that was the that was the theory part of

our presentation today and what we're going to step into together here is we're going to make a chart um together now before we get into any code before we get into any visualizations we need to start with our goals the place where all good projects start which is at the very very end now my goal for this visualization we're about to make is i'm going to have a single message and i'm going to make that message extremely clear i'm going to do that by communicating my my message not only in visuals but also in plain english i'm not going to use redundant visual variables you'll be able to see that don't worry and then finally i'm going to keep it simple so i'm going to emphasize what's important i'm going to really draw attention to what i want the audience to know and i'm going to cut what's not important okay now because this is a business setting and because you likely have stakeholders let's start with a stakeholder a stakeholder

prompt if you will so what you've been asked for by your stakeholders is we'd like to understand the mix of the most profitable companies in the fortune 1000 and specifically which industries are most prevalent and luckily we have a curated data set waiting for us that we're going to jump into which is going to be in a google colab notebook and i saw that the drive resources were just shared so if anybody wants to speed ahead they can go and do that if not i'm going to walk through it

and in this drive notebook in fact let me just go ahead and show you what you have here in this drive notebook you're going to have four different files one of which is the data set one is the slides that we were just looking at and one is going to be the google co-lab notebook that we were just looking at ourselves beautiful well i tell you what um nathan let me pause here for questions and give you some space in case we should ask any if not i'll just continue forward yeah we just had one question that was about um one of your slides when you're talking about the the different charts and i remember one of them had to do with conversions that one yep and it's um this is from tushar and they are saying should the scale always include the min and max even if there are exceptions oh good question and i hate to throw it on the same answer as beforehand but if the min and max are important for the story you're trying to tell then yes now that's the technically correct statement

that i believe however min and max are extremely helpful for orienting your your data now sometimes if your min and macs are way too extreme and they're all over the place some people remove those um data points altogether so their min and max become a little bit shorter so do they always have to absolutely not are they helpful yes it completely depends on the story you're trying to tell awesome nathan i'll just jump right into it then cool so what we're going to be doing here is we are going to be pair programming and it's more going to be a one-way programming because i'm just going to go straight for it and we're doing this via a google collab notebook i like these notebooks because i can share them with you very easily and you can go ahead and go in here and play with them yourself i've mixed in some text here to add some more aid for us

the key point i want to message here is this is not a tutorial on a line by line explanation on how individual things are working this will be a tutorial on how we map the theory that we just learned via code to a visual chart so if anybody has questions around line by line things let's sync up afterwards and we can chat more about that so without further ado let's jump right into it we're first going to import our libraries and my libraries of course are going to be pandas and in fact on data independent i put up like 70 panda tutorials so this is my data processing library choice and then today we're going to use plotly it doesn't matter which visual library you use absolutely not go use matplotlib seaborn plotly whatever the heck you want um this one will be implotly because i like their hover material which is kind of nice cool so with our prompt that we got from our stakeholders what we're going to go ahead and do is i'm going to

create a scatter plot that takes care of four visual dimensions we're going to deal with an x-axis which is going to show our revenue we're going to show our profit we're going to show our market cap which is going to be the size of our scatters but then one other interesting one that we're going to throw in there is we're going to have a binary yes no is this a finance or technology company and we're going to have this should be the color that we're going to show and the reason why we're doing this one specifically is because our stakeholder was interested about which industries were most prevalent in the in the in the most profitable companies and i did my homework before this and i know it's financial technology so i want to go ahead and communicate that if anybody wants to follow along with this specific one themselves um there's a little trick to get um uh your pandas data to read via a hosted csv so here is that csv that was in that

google drive folder i just shared with you what's really cool is i can just throw in this url and read csv let me go ahead and run this and all of a sudden let me go ahead and run this run data.ahead here's that data that was hosted for us so going through this just very briefly we have a whole bunch of columns we don't need all of these i care about things like company i care about their profit i care about their revenue um what else do i care about a few other things in here so i want to clean this up and i don't want to i don't want to have all these the way i'm going to clean that up is i'm just going to take a subset of columns so i'm going to take company revenue profit sector market cap and i'm going to rename my market cap and with this renaming market cap let's look at our resulting data which is much more clean now in order for us to understand i didn't code this one in here but let me do that just for fun let's see how

long how many data points we have of our data set we have 950 companies and to make this really explicit let's do print [Music] we have companies in our data set in our data set and so with this one this will just be more explicit so it's more self-service and this is what you get for live coding i'll tell you what i'm not even going to worry about this right now and in fact i'll just fix that up beforehand because i'm not going to go debug right now um great so we have our data that we're doing right here and next thing i'm going to do is i'm going to go create a few more helper columns so with these helper columns what i'm going to do is i'm going to add a color column to my data frame and i'm going to add a indicator column which is is top

industry now this color one what it's going to go do is it's going to go see if the sector is in finance or technology and if so it's going to give me one color here if not it's going to give me one color here now in order to help us for our labels i'm going to create a similar one for is top industry i'm going to go ahead through the same sector financials and technology if it's a yes give me a string yes if it's a no i'm getting a string now let's go ahead and run those okay cool and so what we have here is we have our color column and we have our top industry column which are going to be helpers for us in a little bit okay so all of that is what we need to do in order to transform our data to get it ready for our scatter plot which this is the fun part now what i'm what i chose to do here is we're going to build out a really cool looking scatter plot but i want to start small so you can see how this incrementally builds up and i can talk

through the different examples about why i chose to include certain things so let's go ahead and let's make our first scatter plot now i apologize i am going to zoom out just a little bit here so that we're able to see some code and some visuals at the same point at the same time if anybody wants to follow along because this is too small please open up the colad notebook so the way we're going to do that is we're going to call plotly.scatter what's really nice is i can pass my data frame and then i can just pass a simple string which represents the column in the data frame so i'm basically telling plotley here hey i want my x-axis to be revenue and i want my y-axis to be profit and then figure.show to show the chart for us and what's cool is we have our wise profit we have our access revenue and we can see a bunch of companies here and oh cool there's some hover capabilities and this is exactly what we wanted to use plotment for because it's well it's

just nice as we can see this one way over here it has a revenue of 523 grand which is why it's all the way out over here and this is actually an example where i might cut this data point if it's not a part of my message because i want to further emphasize these but that's outside the scope here so what we're going to do is we're going to start to add to our chart and we're going to incrementally build out more aspects of this visualization the first thing that i want to do is i want to add a certain chart width in there now the reason why i want to add the chart width is because uh it's kind of sloppy to have it so big and it's a little unwieldy more unwieldy than i'd like so i'm going to add in a height and i'm going to add in a or width and a height which is just going to set the bounce of my charger which is nice cool the next thing is if you remember up at the top we wanted to talk about size and so the size of our data points and the column that i want

to use for side is going to be our market cap column within our data frame because you'll notice here that all these different points they're all the same size and it doesn't give you much extra information where it would be helpful to understand how big they are so i'll go ahead and i'll do that oh sweet so now we can see here that this market cap of this company is much bigger than zooming in say on this market cap of this company nice so there's a little extra information that's embedded in here to help us understand the the size of these these companies nice next i want to add a color so remember i wanted to emphasize which industries were part of which which dots were part of which industries and i specifically made a helper column to tell me which one we're in finance and which one are technology i'll go ahead and run that and nice that's pretty sweet so all of a sudden i split out is this a technology and finance company

yes then it's going to get the red or is this not a technology and finance company and then it's going to get the blue and what you can see here is all of a sudden you can see that all of our most profitable companies are red now i know there's one that's sneaking in right there but that's not that doesn't count it technically doesn't count okay cool so that's about that's where we're going to be now i just zoomed in on here which is another cool thing of plotley but i'm going to double click to zoom back out now the other kind of confusing thing is you can see over here in the legend is top industry and i want yes on top and i want no on the bottom and luckily plotley has a very helpful uh convention for that and you can tell it your category orders so i'm saying hey for my i need to switch to that for my is top industry column yes comes first and then no so let's go ahead and run that now obviously you can see that the yes is on top which is sweet cool

next thing is it's really hard for me to tell which company this is because it doesn't have the company name and the hover well that would be helpful to have the hover the company name in the hover the way you do that is you add a hover data attribute so with hover data i'm saying hey go give me the company let me go around this nice so now we hover over it and you can see the company is going to be labeled at the bottom of this hover tool tip so this is berkshire hathaway this is apple this is amazon this is alphabet this is microsoft etc cool the next thing i want to fix here is this in top industry label that's data speak that's not necessarily stakeholder speak and then profit is not bad but i want to capitalize the p and i want to say company profit same thing with revenue i want to capitalize those and the cool part is plotly makes this extremely helpful with a convention called labels and with labels all you need to do is just pass pass a dict and with this dict

you give it a key of your column name and then you give it the label you want to call it so i'm going to call revenue company revenue i want to call profit company profit and i want to call techno i want to call top industry i'm going to phrase it as a question is this technology in fact let's just label it like that is this technology or financial cool so we have that and so our company profit worked our company revenue worked you can see is top industry didn't work and the reason why is because i passed it a bogus column name that it didn't know about and then there we go so with that one we now rephrase this to our legend is this a technology or financial industry yes that's blue and then red is no nice the other thing here too is much like all good visualizations that we were just talking about beforehand i really want to drive home the point and the message i want you to take away from this and specifically answer the

stakeholders question the way i'm going to do that is by adding a title to this chart so with title i'm going to say hey my title equals technology and financial companies are the fortune 500 1k most profitable industries let's go ahead and do that boom now we have our title right on top of our chart so what's kind of funny about this and it's a good way to know if you're doing your job or not let's just say you only had the title and you didn't have the chart would you be able to glean

the message from this and because i literally put the takeaway right in the title i'm hoping the audience will be able to do this cool now the next thing i want to do is i want to continue to drive this home even even further and make this as much of a no-brainer as possible and you saw me highlight this middle section beforehand well i'm not going to be there to present this to my stakeholders i want this chart to be able to speak on its own and the way i'm going to do that is add annotations to the chart that really call this out for me now traditionally i'd probably do this in a google slides or some sort of like presentation software it's a little bit difficult to do this within code but at least code has us do this programmatically and the way i'm going to do that is i'm going to call my figure within plotly and i'm going to say hey go out of shape for me and what kind of shape do i want i want a rect which stands which is short for rectangle

now what's cool is that you give it an x zero and a y zero which is basically one corner and then a y one and an x one which is another corner and you can also pass it a color that you want your rectangle to be i'll go ahead and run this nice that is pretty cool and you can see here that this the lower bounds of this rectangle are a little tight for me and so i'm going to raise that just a little bit by starting it off at 19.5 instead of 19 flat and that came up just a little bit

nice cool well calling out a rectangle doesn't do anything for me because the audience is going to be like what the heck is this rectangle for why are you calling this out and in order to further emphasize what this rectangle is and why it's important i'm going to add a shape and then a piece to text the shape is going to be a line shocker add another shape this is going to be a line specify where it starts and where it ends and then give it another color which is cool but then the key part is i'm going to add some context to this chart and the way i'm going to do that is i'm going to add text to this chart so i'm going to say the top 10 most profitable companies are technology uh that doesn't really make a ton of sense the top 10 most profitable companies are in or in technology or financial let's do that that feels a little bit better nice and these brs these are uh breaks in your line and a little bit of html that plotly lets you put in there so

there'll be a line break after each of these in fact let me just show you what it looks like without the line break so you can see why i did that in the first place so if we go ahead and run this cool the top 10 most profitable companies are in technology or financial awesome but you can see here how it's kind of stretching all over the place i wish it would wrap a little bit more and so i'm going to add in uh some line breaks cool that's much easier for us to digest and look at nice so the next thing let's see if you have anything else no so that's our chart for right now we could go freaking crazy and do a whole bunch of wild things but what i'm going to do here is i want to share this chart with the world and i want the entire world to see it so i'm going to take this i'm going to head over to twitter i'm going to head over to data indie i'm going to tweet out hey just made this chart with data science dojo and it was awesome what charts have you made recently nice

hey make sure that's good looks good tweet that out fabulous and this is a small plug but go and follow me on uh twitter and this is where i post things not only about data but then also around data careers and kind of analysis about the data industry as well um and with that that is our chart and nathan what do you know we're right at 39 minutes in so perfect a little early um so uh before we get into q a because we do have some questions and i want to give people time to type out questions if

they have them again please use that q a tab um so i'm going to take the screen from you for a second and i'm going to talk about um our webinar next week really quick um and then we will uh get into q a for everyone and release that certificate which i'm sure people are uh are here for um [Music] all right so um hopefully you can see the screen but next week july 6th at noon pacific time so the same time as today uh we will be having bill frank bill franks the director of chief

analytics office officer um for statistics and analytical research at kensaw state university uh and he's going to be presenting winning the room creating and delivering an effective data-driven presentation which is pretty close to what we did here today and it kind of lines up great so if you really liked greg today i would definitely suggest joining next week with bill franks and then team data science dojo team why don't you go ahead and release that certificate for people to fill out the

form for um we will post it multiple times so don't worry if you don't see it the first time and it will be live at least for another 20 minutes um so plenty of time to fill that out and with that um let's get into some q a and greg you're probably going to want to share um um yeah share your screen i think because some of these are are relevant to the collab sheet and everything so um first uh this is from an anonymous attendee and it's perfectly okay to be anonymous it

means i don't get to butcher your name when i say it um how to make sure your desired question doesn't create bias in the chart yeah that's a great question there's no point in making the chart if your question is off or if your mission is off in the very first place and so let me write how to make sure your desired question doesn't create bias in the chart so this is all around stakeholder management which unfortunately is a much larger topic but before you even go and make your visualization you want to help your stakeholders understand will the question that they're asking actually drive home the point that they want to get towards um the quick helpful tips that i do for this is asking what are their priorities um what are their pain points what are their mission like what's their risk what is their goal for the company or the department about what they're working on right now because sometimes they'll say i want to increase more users and then they'll ask a question

that say you know let's just say they ask a question that isn't relevant to increasing more users and you would have not uh you would have maybe misused some of your time going down that route so there's a whole other skill of a data analyst to help your stakeholders clarify their own thinking to make sure that your work is going in the right direction so how do you make sure bias your the question doesn't make the chart make sure there's no bias in the question in the first place before you make the chart and then um isaac and this is i guess related to the files we just shared with everyone um are we going to have access to the google colab notebook after the webinar i don't see so but let me just show you right here google collab share anyone with anyone with the link can view so if you don't please let me know and you should yeah and we will um on our website as well as on youtube and literally everywhere else we post this uh um

this recording as well as in the email that we send to people with the recording uh we'll have um the the google drive either the url or all the individual files will have as resources so you will be able to have access to those um all right and nisha is asking how do you know that you have to choose financials and technology sector and i think that was outlined in the question that was that you were answering yeah it's it's a great question i skipped over that part i skipped over

the analysis part of that because that would have been overloading the presentation but just to very go and go into it super briefly if i'm looking at my df right here and i say sort values buy and i'm going to say profit and then i got to say a sending a sending equals false to look at it i i literally just sorted by this and i saw that the top 10 were all technology i guess there's one communications in here but they're all technology or financial so i did this work beforehand i don't want to

skip over that for you um all right so nisha great question um this is from betty and betty has two questions so the first one is um and i this was while you were going through the collab notebook but i'm not exactly sure when yeah is access equals one referring to the second column of the data set great question um so that came up in this df.rename and this is when you rename columns well let me let me rephrase in pandas they let you rename an index so this rename function renames

an index well in pandas you have two indexes well two or more you have your rows and you have your columns and so pandas needs to know do hey do you want to rename a row do you want to rename a column and access equals one is their confusing way of telling them hey go rename a column don't go rename a row because there's no row named market cap and then the second question i see here yep and then betty's second question is can we add a legend on the scale of market cap to see the min and max

Ask anything

We've read this whole study set, so questions about it get the best answers.

FlashcardsQuizFill in the blanksWritten testLessonNotesPodcastContent