Data Visualization Using Python | Day 1 | LetsUpgrade

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] [Music] uh hi hi guys hello everyone can you hear me great great great hi so i'll start with my introduction uh i'm soap shake i'm a part of team let's upgrade most of you all might not know me i'm from the back inside uh but today i've been given this opportunity to bachelor to open this program launch this batch that is data visualization using python so first of all talking about the course as you all know by the name we'll be doing data visualization using the language python i'll tell you in deep about the course like other details about the course first of all all of you might be uh interested to know about whether you get the certificate or if it's free or not uh it's completely free all the days the assignment teaching life teaching everything is free for you all next about the certificate to get the certificate or the only thing that you need to do is attend all the days that all the days of the session and you will be eligible for the participation certificate but on that but if you complete your assignments right so if you complete your assignments we value your work and we'll also be providing a completion certificate to all the students that have completed the assignments uh you will get the assignments on the learning management system the learning management system i'll just show it to you how you can get there one second yeah i'll just share my screen i hope you guys can see my screen i'll just guide you to our website so this is our website let's upgrade first you need to go and login that now here if you see under the profile section uh there is a program section right once you go to the program section uh my internet is a bit slow yeah so here if you search data visualization you'll get the course i think that that's not then this account but let's take this account for dummy if you go get in there you'll see the all the classes of your sessions and when you click on the class you'll be guided to this session where you can see the video the details of the class here you have the chat even if you go right now here you can mark your attendance this is some other program and in the detail section right here here you will be having a link to all the assignments and other details of the program so that's all about the certification and the elements now make sure you are enrolled for the program by going on the website and registering for the program uh now without any delay in your learning first i like to call upon our instructor for this program uh we have lakshmi man with us hi mom hi good evening how are you good evening yeah so i'd just like to give a very very short introduction about ma'am because if i start will be a long introduction to them uh so ma'am is and mom is right now working in the industry so she is the best tutor that you can get uh to learn this program she has an experience in working in industry as well as teaching students so for the whole course your instructor would be mapped now if you have any doubts you can uh post it on the community you can go for a support email support at the left subreddit even if you see in the chat there are few uh there are moderators that will be helping you so you can go you can just put your doubts in there and they'll be helping you now without any delay i would just like to hand over it to man so she can start the session what do you mind yeah sure so good evening all of you um so welcome to uh let's upgrade uh essentials program so so today we are starting uh with a data visualization using python okay it's a it's a four day session three days of learning uh followed by uh one day of you know career counseling sessions so i welcome all of you to the session uh it's going to be a hands-on session okay so before i begin um there are uh like i would like to ask you as to whether you are like you are attending the session because you would like to know what data visualization is all about or you're learning it right so how many of you uh already know python okay can you please put it in the chat if you know python just say yes you know python otherwise say uh no you are yet to learn you're you're about to start learning you're planning to learn yes okay so this is going to be a very very uh basic um okay tutorial or you know you can see a session very basic session okay so today we will be covering all about matlab matplotlib okay so yes yes okay so few of them are saying yes they are beginners many of them already know python and some of them do not know so to people who are just saying no i would like to come in case if you want to get into data science if you want to you know start learning data science i think python is one of the best languages apart from our uh you know you can start learning it's very very easy we even in uh let's upgrade you have these python sessions and you can you know see the classes or the sessions you can register for a live session or you can already view the sessions that you can select so it will give you it will familiarize you with the basics of python okay there are many advanced courses also or you can even register for a full in case if you want to become a python developer you can you know you can plan and you know you can learn in that perspective if you want to become a python developer okay application a developer or anything but in case if you want to become a data scientist if you want to become an ml engineer or if you want to pursue a higher degree in a will one of the very essential topics that we learn in the very beginning is data visualization okay and three of the main libraries that we deal with this one is matplotlib the other one is c bond library okay matplotlib and uh you even have plot link okay so these are the few uh libraries that we deal with so let's start today's session let me share my screen okay so all of you can see the so so so what is data visualization so we are just starting the session okay i hope uh you know if you have any doubts i'll give you some time okay to ask doubts so you can just listen to it and when we start hands-on session you can also do it along with me so what does data visualize so data visualization is nothing but uh whenever you deal with data okay whenever you deal with raw data okay data what do you mean by data any information that is collected related to anything it's just nothing but it would be a numerical value it could be a binary value anything which is in the form of uh you know excel sheet okay in the form of rows and columns that's what you call a data so if you see there are many you know you have uh you are given a data which could consider which consists of uh you know the data that is uh obtained from uh the weather of a place or the visitors who are visiting a particular restaurant who are the types of visitors and how many of them okay how how many of what which type of visitors like what food what is the bill amount and for a particular bill about what is the tips that they have paid as an a you know as a token of uh you know appreciation tips that you pay so from a restaurant you collected data from hospitals you could collect a data of patients wherein you have a name against the age the ailment or the medical condition for which they have come and then what is the outcome whether uh so for each disease or for each medical condition what is the treatment that's given what is uh or if it is an x-ray report or a scan report so which is what what is the age of the patient so for each patient what is the region that is scan what is the outcome of the scan whether if they have a tumor okay if there is a set of you know people who have a tumor so is it benign or malignant so it's all about studying the data and using ml models or machine learning models in order to predict if you can identify based on a huge amount of past history if you are able to analyze it so that is what machine learning is all about but before you build a model okay you cannot directly get the data and build a model you have to understand the data so there are many many ways of understanding the data one of the very basic uh a way of understanding your data is visualizing it okay so as you know a picture is worth thousands or thousands of words thousands of words thousands of you know uh thoughts okay so when you see a picture symbol when whenever you see a graph whenever you see a picture that's worth thousands of words okay you don't have to so that's how you human eyes interpret so if you are able to uh visualize the uh data okay if you are able to see what the data is all about how each and every column each and every so column is called feature and then the rows are called as observations or something okay so or every record so if you are able to ah study the relationship between different columns of data or different features in a data you can ah interpret you can understand a lot of things about the data so one of the thing is there are you know mathematically if you go you if you use your statistics statistical knowledge you can understand the relation between the columns statistically numerical column statistically but apart from uh so if you if you don't want to get into that you all you want to do is or you are given a data and you are asked to derive as much of information as you can from a data any given data i was talking about a lot of examples right now about healthcare data you know anything from a pharmaceutical industry anything from uh you know oil oil and gas refinery anything it could be from any sector okay any sector or including the number of tweets or twitters twitter or it could be a world cup okay upcoming world cup data okay data of the performance of the players in the past so with that you have to predict how the performance will be in the coming matches so anything data could be anything but what is your thing is uh you have to tell something you have to tell a story out of the data you have to understand the data so one of the most easiest way of doing the data is data visualization so data visualization it gives a visual context of the data through graphs and map so graphs are nothing but you're just plotting the data in the form of a graph okay with its units labeled and you're plotting one against the x versus five so you are you you are considering any two features and you are just plotting a graph and maps are nothing but you again it's very much similar to your google maps okay google maps if you open you just see a you know picture of the map a map and then you can see uh you know the traffic where you are at present what the the geo location of you know various traffic and you know the places and all that okay so even the weather conditions so those are maps okay and data visualization when you do it's very easy to understand even for a person who does not know python it's not at all required that a person should know python or the person should know data science you can easily understand the data okay it's very very easy and what do you derive you can derive some trends patterns and even outliers outliers what do you mean by outliers outliers are nothing but any data which is far from the normal value for that particular label for that particular feature if you have you know you have some value which is totally abnormal okay so which doesn't logically fit in a particular column so that is what is called an outlier so you can you can study the trend you can study the pattern and you can even identify or detect any outlier which is present so this is what data visualization is all about okay so why is data visualization important why is this thing important so it gives a visual summary so whatever the information you have it gives a visual summary of the entire data and in you know in business intelligence if in if you have uh you know in business units you can present you have to present your data or the findings of findings from a data uh through a storytelling okay through you have to tell a story you have to present your data to somebody to managers or to your higher superiors you can use a lot of different visualization uh okay methods so how is data visualization used okay it gives what all does it entire like for what purpose it is used so it's used to uh you know plot changes over time it is used to determine the frequency uh for example uh what is the frequency that after which a particular event is occurring okay so you have certain data that is the frequencies of uh you know air airplane you know uh airplane safety measures you have a data related to that airplane safety wherein you have you can know the number of fatalities the number of accidents that have occurred from 84 to 90 90 to 98 and total number of accidents that have happened air uh you know fatalities that have happened and uh uh where in which countries that's one of the data so if they tell you if you can do a lot of uh you know determine the relationships between means what do you mean by relationship any two features whether how how is it related to each other when inner data you are given a data you will have to find b which are the features that are related to each other whether they are positively related or whether they are negatively related for example you have this uh you know sales okay sales so as the demand of a particular product increases in the market the price also goes up so price as well as what you call uh the price of a particular product as well as the demand so they are positively correlated with each other the price as the uh number of sales goes high the number of uh the cost also increases so sales and price are positively correlated for a particular product the number of sales is increases that means the product is in demand which means the price would also increase so demand okay versus the price and then so these are the that is what is the third point determining the relationship next one examining a group cluster or a network so for example if you read if you take e-commerce websites like flipkart amazon uh there are certain products which are you know certain groups of people which uh buy a particular part type of a product who buy a particular type of products okay now for example if you take electronic devices very high-end electronic devices like you know you have this uh you know alexa and all that so who are the group of people is it middle-aged people or is it youngsters teenagers who prefer or buy the product or is it people who are you know who are senior citizens who buy that one so what type of kindle or any kind of books or any kind of you know uh baby care uh products okay baby products so there is a group of people who buy that right so how do you examine which group of people buy what okay so if you have a shop and if you're trying to uh you know digitize your shop and you know build a website for your shop you have to analyze which products to be recommended to which group of people so that is what it is used for so examining a group a cluster or a network and then scheduling what do you mean by scheduling suppose you have a project so i am explaining each of these points i hope you understand okay what do you mean by scheduling if you have to do a project okay you will be given a timeline timeline so if the project is to be done from october till december so even twice you'll have to schedule it so that scheduling that scheduling can also be visually be represented okay it can be presented visually so that's what the these this is why you go for data visualize these are the different reasons why you go for data visualization so what are the common data visualization types so the below one this one that you see it's a line line chart or a line plot okay it's a funnel plot pie chart bar chart area chart you have scatter plots okay you have histograms there are so many other type there are so many types or thousands of types of you know data visualization but we'll be covering only very few the first one is line chart so before we start line chart i would like to take a minutes break okay and just ask you whether you understood whether you have been following me in the previous slides whether am i clear as to what is data visualization why is it important and what are the different ways and the reasons why it is used is it clear can you all please put your responses in the chat it's only then they can that you know i'll get to know whether you're following me please put it in the chat whether you understood whatever i just told you yes understood okay yes very good yes i'm happy about it thank you so much for your response essence it's you know uh so this helps you know when you respond it's it it really helps just one person like bala murugan has told to repeat again the most almost everybody has understood yeah very good very good so what i was telling is okay so so that's what so data visualization is a visual interpretation of the data which can be done through maps plots x graphs etc it's easy to interpret okay and you can study the trends patterns and outliers okay why is it important it just makes you understand the data very easily and how is it used so all the five it gives you how a particular data changes over a time and the frequency the relationship how to examine a group of people or a cluster okay and then scheduling of work and these are the common so the first one is line chart so what do you mean by a line chart so line chart is the most simple plot data visualization plot it is this displays what how uh two features are varying okay and it displays data over time most of the time okay so there are points that are connected so when you when we do it so we'll understand so a line chart uses points connected by lines to display data okay and you can do a lot of uh variations in the line plot okay you can include a lot of other things like the what type of line you want what should be the line width what should be the marker or the dots are called as markers so how what is the you know how do you want the markers to be what should be the scale the axis okay all that you will learn okay today so line chart is something which we'll deal today so this is a small example of a line chart that's given that is greenhouse gas emissions by different sectors so in the world okay so you are given uh it's it's nothing but the different uh estimate okay for each each uh sector that is the aviation so what is from from over the years how much is the greenhouse emissions so as as by far you see electricity and heat is the sector wherein there is there has been maximum greenhouse gas emission that is greenhouse emissions are measured in terms of carbon dioxide equivalent that's not good for the environment so you can see which is the minimum the lowest okay so that's what you can see the next one is bar chart okay so this is line chart it just plots data over time and it's just represented by means of lots of markers and it's used to you can see how the very how the data varies with time in bar chart you have two or more rectangles okay so and uh each bar it represents it's the same thing here whatever you saw in this graph this is also the same thing as you can see electricity and heat okay it has a maximum emission right and in the next plot also you can see the same thing that is the maximum emission so that bar represents the value of that particular variable the variable is what electricity and heat is the variable and what is the length of the bar the length of the bar corresponds to the value of that variable okay so where is it used they can be used to represent or display the data entrance over time when the bars are placed in the order along the axis representing this bar it can either be placed uh these right now the bars are placed horizontally the bars can also be placed vertically okay so you have a small variation you have bar h is that if you add that it will be horizontal otherwise it's a vertical glove uh moving on the next one uh so this is the again the carbon dioxide emission by sector and the record taken in the united states in the year 2016. the next one let's move on to the next type of loss every plot is different and let me tell you let me tell all of you there is nothing defined okay you have to plot you have to use only this plot for this nothing it's all up to your choice how you want to represent the data how do you want to identify the pattern whether you want to plot a data versus time in the form of a bar plot or whether you will have to identify what you want in order to identify what type of data visualization plot to use you should you should know each plot that is basics of each plot so that you can make use of it in your own data okay so scatter plot is nothing but it displays two variables of the same data point along x and y so so when you have a point on you know uh so it that particular point any point every point in the scatter plot it represent what the x value is and what the y value is okay so scatter power plots are used to identify trends and relationship between two variables for example for a group of people a group of 50 people weight versus height individual's height okay could be on the y-axis and individuals height can be height on the x-axis y on the y-axis could be the person's weight so height versus weight okay x versus y so ah that's also one type of so you will you'll understand okay how uh how for every individual how it is differing and how much it is different this is pie chart again a pie chart is nothing but it's very similar to that pie that we you know that uh the food that we eat that there's something called a pie so the pie chart is also it gives it it is a circle for and you have the circle is divided into a number of portions okay or slices okay and each slice shows the proportion so pie chart is also something today we will deal with okay so each each sector or each piece in the pie chart it signifies it represents what percentage that particular feature or uh value is okay among the entire things so the entire circle is hundred percentage out of the hundred percentage how much is the energy usage in for example okay how much is energy um use in industry something so what is energy so energy represents 73.2 out of 100 and how much is agriculture forestry and land use so what is the percentage okay so pie charts are commonly used to represent the percentage okay so uh this is also something that today we will see in today's class so mainly in today's class we will see uh uh what line line chart we'll see bar chart you'll see pie chart okay so so um all these can be uh if you're new to python uh so you can use either anaconda so in google you can just type anaconda okay okay anaconda install okay so it's uh nothing but you so this is how you start okay in case if you do not have anaconda installed it comes as a package okay you have spa you have jupiter notebook you have r studio you have spider labs so you have a lot of things installed so so if you install here it's all it's free of cost okay so you can download this data set okay [Music] where is it open source okay so you can go to this okay or you can just give anaconda download all right okay so you can use this so depending upon your system whether okay you can just go ahead and download this so this would come as a package okay so it's very very easy for people who are learning data science if you are starting with this okay compared to other uh you know so forth okay or else you can even go for if you go to your gmail okay you can open your drive okay you can go to your gmail you can open your drive okay and then in your drive you can have this new okay you can create a folder and you can go to more and you can go open a google collaboratory a google collab so this is another so in case if you're using a system wherein you or you don't have enough internet to download anaconda you can go for google collab okay so so yes so shall we start with hands-on are you yes i hope you can hear me all of you okay so let's start with hands-on all of you can do along with me so this is just a definition for uh data visualization okay i hope you can so in case if you don't want to go for this thing you can just uh you know start with this okay google collab okay so i'll just go clear all the outputs and so that i can tell you all right so data visualization is a process of translating data metrics into charts graphs and other visual reports and these visualizations let the viewers or anybody okay discover patterns and relationships in the data that otherwise might not see okay just otherwise if you are visually representing it just by looking at the data you will not be able to see any patterns in it so helping to turn the information into a cohesive story so this is what i was talking about from a data you have to uh extract as much of interpretation as much of information as you can from through in the form of a story so data visualization enables organizations and individuals to gain a clearer understanding of their performance and goals so it gives a very very clear picture about their business goals the current trend what was the past what is the present how how do you you know how can you foresee the future if this repeats so all such kinds of business visualizations business ideas or business uh you know you know what is the current uh whatever performance and goals metrics everything all the metrics can be plotted okay so some of the most common charts are as as i told you right now so you have this line plots area plots histograms bar pi box and scatter so we will divide the set sessions and then we will divide okay so before we start uh so whenever you are installing anaconda or um you know when you're opening your jupiter notebook it does not so this is uh this is the jupiter notebook okay so you have you can just uh you can it's the same thing okay the way you have been doing you can do the same way okay so we'll see we'll start with this okay the first thing that you have to do is even though you have these libraries installed you have to import these libraries so the first thing is importing the libraries so you have to import pandas okay loading the libraries basic libraries okay packages okay so you have pandas numpy and matter so from matplotlib you have to import pipelot as php so you can just use these commands okay can you all see it is my screen very clear to you yeah herschel i'll tell you how to open google collab yes so you sign into your gmail okay so this is my uh what do you call it this is my gmail drive open your drive okay and in your drive you can create a folder if you want go to new go to more and go to this google collaboratory okay so it will open and then you can rename it and you can do uh you know whatever i right now okay so you can rename it and then you can you know do this import pandas okay import like this okay and then if you have to execute a cell you can press shift and enter so shift and enter all right so if you have to comment anything you you can add a text and all that so you can add a text okay so you can run it okay so it's very very easier so once you open and then you can rename this thing so it is always a i i p y and b file okay i p y and v that's a python notebook file all right so you can do this okay uh so once you've done that let's do a basic plot now as you see we have imported matplot lib okay matplot live or you can you can say it as matplotlib before that let me show you uh this thing okay so this is the matplot documentation okay so [Music] you have to uh you know you can learn okay there are so many examples that are given to you so these are the i told you there are so many in math.lib itself so you can see the different types of line bar and marker chart so every these are the examples that are given so horizontal chart okay uh it's a broken bar chart so these are the different types of whichever you want okay uh you can you can just choose that okay so see the line styles lines basic line plot okay it's a simple plan see uh here you have the scatter symbol scatter plots with a legend okay different a scatter plot with histograms a simple scatter plot okay so these are the see there are so many so if you just scroll down you can see how many are there so let me find out okay control f line okay so which is the first customizing line is there any other line line plot so simple plot okay let me choose this open in a new link so you'll have to get used to the idea of you know always whenever you're starting uh you should send spend some time and uh you know learning this okay so here also see they have imported the first thing that they have done is they have it's just an example that is given to you a simple plot okay okay so yeah so this is a sine plot as you can see okay so they have given so this is the x-axis and this is the y-axis okay so x versus so what is x see the data for plotting the first thing is t okay they have created a variable called t and they have used the numpy library uh to uh dot a range what is the a range it's nothing but it will give you uh you know points data points varying this is the starting data point this is the ending data point in steps what is the steps in steps of 0.01 speak hindi uh sorry i cannot do that it's a it's a session in english okay so from where am i not clear from where so yeah have you can just go to uh let me start with this have you all understood till this first line till loading the libraries have you all understood please reply till till the libraries okay i just asked you to load three libraries okay yes okay now let's go step by step what i also wanted to tell you was you have to go to google okay and use matplotlib okay documentation just give this okay in google go to matlab so it's nothing but this is nothing but it's a plotting library which is okay for python programming and it's numerical mathematics it's mathematical extension number okay so you can go to this matplotlib okay and you can go through the different examples okay so tutorials for example so as i told you okay there are different uh samples that i give it to you so see you can see the example page so matplotlib version is the current version is 3.4.3 correct so it will keep up getting updated so what i'm telling is matplotlib is not just about the line plot the bar plot the by piper it's not just about it what i want to tell you is if you just open the documentation for every graph there they have given a uh what do you call they have given the code it's a sample code that is given all you have to do is you have to edit it according to your data that's all okay so you are given if everything you are given so i just want you to know that do you don't have to buy hot any code just go to google type matplotlib and then open the examples open the example gallery okay and you can choose you can do anything in it okay you can just see a simple bar chart okay this for example if i just put this okay if i just select this see this example shows a simple horizontal bar chart okay so these are the different person's name that performance how fast do you want to go today okay is it performance for hour or anything i don't know that but then so for for example maybe i don't know what this data is all about but it just says that how fast do you want to go today so tom these are the they carry so these are the data's and see people okay and then uh it's randomly selected okay you are fixing a random state value what i mean to say is it's not necessary that you have to understand the code right now what i see what i need to say is you have you can there is something like you know documentation you can open the documentation you can plot anything that you want this is what i just wanted to tell you okay there's nothing that you have to understand here okay when you're studying matplotlib you should know that in a new tab you can open the documentation and you can whenever you're free you can just copy paste the code and plot it edit the code and you can see how the graph is varying is that clear is that clear okay so let's brief it up now see now that you have downloaded or imported matplotlib dot pi plot as plt okay so plt is what we'll be using everywhere so the first thing what you'll do is you're just plotting okay it's one it's just two list of you know elements list of numbers the first list is one two and three and the second one is so this is x and this is y okay so you can do the most basic your first basic okay first basic plot okay the first basic plot that you can do with this type plt plt is the library matplotlib dot just give a plot and within parenthesis you can give two list of elements and just press shift enter okay so this is the most simplest plot that you get your first plot that you can do in case if you just want to avoid this particular line you can just go and give plt dot show open and closed okay and give shift and enter so you'll see this graph now this is the most basic graph so what is what is actually happened so when x is 1 y is 2 this is the first point okay when x is 2 okay we have not put any this is the basic graph okay for which has been plotted against x that is 1 2 3 versus y that is 2 3 and 4 okay here you are just plotting between two different sets of numbers okay so when x is 1 as you see x is 1 this is the first point y is 2 when x is 2 y is 3 so when you see x is 2 you can see y is 3 look at this somewhere here and when x is 3 okay you can see y is 4. now to this particular basic plot you have to add a lot more you have to beautify this particular plot you have to add labels to it you will have to add markers to it okay you can add legends to it okay so this is what we'll be doing correctly okay so this is the basic line plot line chart you can say or you can say a line plot so have you all done this have you all done this have you all got this plot you all you have to do is just give any numbers any set of numbers you can give okay it's not necessary yes so right now that now you have learned how to do a basic line plot this is as simple as this now you can modify this a little bit by doing you can just put this copy paste this thing okay and put a link variable called x equal to paste it okay and then y equal to you can paste this thing take this and then you can remove this so that it looks a lot more simpler same thing okay now you can add a title to it plt dot title okay you can add a what what type you do my first line chart all right if you give enter you can see this okay now let's label our x axis and y r y axis okay so let's do plt dot x label you can put it as x axis now how will you know this okay what you have to put let me tell you okay so plt dot x label you can give your the name of that axis or you can just put it as x axis and y axis all right so so when the way the chart was earlier without any labels or anything you had not given you had not marked the access you are not given a title now few things that you have done this you have added a title you have added labels to your x-axis and y-axis okay so this is something that you have done just now so this looks all the more better right you have done something yes or no yes okay now what we'll do is we'll additionally add certain things okay now these are the things that we are going to add first yes okay so here as you see in x-axis it's labeled as one 1.25 we can you can customize that okay by adding something called x6 and y6 okay so i mean x x is nothing but so these are the units here okay so you can give this all right x 6 and y x so if you give enter what you see is c 1 2 so you can customize it all right okay so you can customize it as say for example 1 and then one point five comma two comma two point five and y y label s again okay one comma two comma three comma four okay nothing of this kind okay or you can zero one you can all do along with me all of you can do along with me okay so okay so x x and y text you can uh okay you can do like that okay so it's or else though let me change this okay so that it looks all the more easier this looks a little better right compared to how it was earlier so you can scale it okay so 2.5 i can even include a 3 here these are nothing but uh you know you are just labeling it so 5 is not at all required the maximum value in y is 4 okay so i just remove this 5. okay so this is how the you have you have changed the how to access this okay now let me you can include something called a marker okay so here i'll just copy these markers and let me show you that i'll tell you each and everything okay so here plt dot rather than just uh you know plotting x comma y you can include a lot of other variables so first thing that we have to do is labels okay now if you see uh it's just it's just a label that is given okay so uh in your graph you can give anything okay now if you just check here okay ah in your documentation okay if you just find okay uh he plot okay let me open it and show it to you come somewhere under p okay so see so this is the plot so just open this plot okay so here if you see what is this plot see uh this entire thing you have imported this as pld so what will you write plt dot plot and you can include a lot of things okay lot of arguments can be included okay so for example see uh there are multiple ways the most straightforward ways you have to uh you can give okay this is nothing but blue okay this is nothing g stands for green and then these are the markers okay let's put this and see in ours okay i'll just go to mine okay i'll just comment this thing for a while and we'll use this plt dot plot okay x comma y comma i just pasted uh sorry it's b o okay that's what we saw there and let's see how how what type of you know what is the difference so what is it so it's nothing but it is just plotted b is nothing but the blue line and then okay so this is nothing but so you have this blue color line and you have put these markers okay the line is ma the line has the you know uh style the line style is dash dash b stands for the color okay and o stands for the marker so all of it i have written it here okay so you can put it in any way see this is the expansion x x is the x variable y is y variable labels you will that you can give it later okay the color is green okay here we have put blue what is the line style equal to so this is what line style you can give there are many types of markers you can give okay what is the size of the marker and if you want the marker edge you can put a marker edge as blue the line bit can be put so for example if i give line width is three okay i'll just pop i just paste it here let's see what the difference is uh oh sorry line width i'll just type it rather line width equal to three okay this see i have i've just commented this line okay for commented means it will not execute this is what means commented okay you can just put a hash sign and you it will get commented okay let's execute this see this is the line break okay now let me put a marker okay so if you put uh marker okay equal to uh within bracket star okay let's see how it happened so can you see small star marks here okay so let me i'll just uh place this thing so see markers are nothing but those points okay marker size you just put it as 10 marker edge color is r okay red these are the marker points can you see this i hope you can see these are the three markers so the markers indicate the values of x comma y okay okay so this is it so you can just delete this o okay so we can execute that so now you can see earlier you had even that oh was also the star was also there once somebody had just asked me that doubt so why if o was there okay have you understood so this is nothing but the different extra attributes or arguments that you can bring inside that plt dot plot if you just put x comma y you saw how the plots where right additionally what all different things can you give these are the so for that you can just refer to your documentation okay so in your documentation if you go and type legency legend is here where is it legend you can place legends on axis see legend okay so here if you have to just give label okay so what do you mean by legend see place the legend on the axis so these are nothing but these are you're just labeling what plot it is how is x okay you're just labeling your plot so let me give so here you get this give label okay equal to so here and then when you're doing a legend it so it's expecting this everything is the same okay we'll just plot this itself and then you have to add something called plt dot legend okay plp dot legend in order for the label to get displayed in the plot so here you have this given label of what x is x versus y is for that particular line plot what is what should be the color what should be the line style what type of a marker you want whether it's o or star or anything marker size so all this you can include here okay you can go to your python documentation and you can see this all right see you will have [Music] legends markers everything okay if you go to plot okay you can see this see okay see color is green marker oh line style second i just copy paste this thing okay and just put it here hope it gets got copied color is green marker is involved lines style is dashed is this thing and then line width and marker size this is which is already given there okay so let me delete it and then control it so this is what is the variation so it this is how it looks so the line is green in color you have the labels so this is the legend okay see 2x is the variation so you can include a marker the line size everything okay so from where did i get this i got it from the documentation okay see its everything is given plot x come over it plots x and y using default line style and color if you say b oh it just says see b and o b and o stamp if you add a b o it means plot x and y using blue circle markers okay just plot y means it plots by using x as an index array okay so r plus means red red and pluses so these are the different so uh if you go to the documentation you'll be able to see okay what all different variations you can bring and what are the parameters see marker see what are the different types of markers so you can open this and see this so here okay see the markers so these are the different types of markers that you can do the dot the point pixel circle okay the smaller over circle and then v stands for triangle down so these are the different types so it's only from the documentation that you can pick up what you want okay so if you put eight it's an octagon so these are different types of markers you should be you should at least know that this is how see you don't have to understand anything you just take a look at it and then you can pick up it okay you just you should know you have to have this habit of referring to the documentation that's all i want okay if you don't know anything if you want to beautify your chart go to google type in your you know visualization library open the documentation go to the examples and pick up whichever extra functionality you would like to have okay so you should just know okay you can you have to be familiar with this my intention is not to explain everything okay so if this is something which you can do okay so you can it's additionally you can refer to this documentation and you can add it in your file okay so now i think almost we are complete we have we have added an x label we have added a y label we have plotted some x and y uh you know two list variables x and y you have label you have added label you have added a color you put a marker you have added a line style feature you put a marker size okay marker size means this dots are markers if you reduce it to see 15 or 13 it will increase the size would increase got it so that's what so in this marker also if you can if you want to put a v i just saw there's a v there see this is a triangle it's just nothing but how to beautify your chart and then this is something which you have to remember plt dot plot will just plot pnt dot title will just add a title to your chart these are you can label your x axis and y axis using dot x label dot by label dot x sticks and dot y ticks is nothing but you can see again let me explain you what is x sticks and white x okay from the documentation let me explain right see x6 is nothing but get you have to set the current tick locations or labels of the y-axis okay you can pass no arguments to return the current balance without modifying them so this is nothing but like an array and it is optional because by default itself it will consider the default values and it will put it in the axis but if you want to change it you can use it using the feature okay this parameter called x6 okay so and then legend is nothing but again you have to just show this thing okay what what plot have you done what is x versus x what is the relation between x and y you can just put it as a and then plt dot show i hope you have done your first graph let's move on to the next it's again the same thing okay and all of you can do you can just uh try this okay and not show the graph okay additionally or you can also do this thing if you want to save your graph okay additionally if you want to save your graph okay in your directory whichever directory you are currently working on you can save this plp dot save fig okay and then you can put the name for the figure okay my line graph or something and then this is nothing but pixel okay d for the so how many pixels per inch or something okay so that is the resolution of the image okay so ideally you can set it to 100 or 300 in case if you're if you're setting it okay okay so yeah fine dpi so it's nothing but resolution let me just check it for me e5 so yeah dots per inch okay so it's nothing but see the dpi method of a figure module of matlab library is the resolution in dots per inch okay so d dpi okay you can just give it and you can save it and also you can resize the figure okay wherein we can choose how how you want the figure to be plt dot figure okay and then you can give figure size okay look for like this okay you can add a bigger size and you can give an enter so here nothing but the figure gets resized the size of the figure gets resized okay so what is the size of the figure that you want okay you can do anything so this is how you set the figure size in case if you want otherwise if you don't want you can you know all these are additional features have you all understood and now now for you you can at least you can do it as an assignment okay so this is a plot okay you have to do everything the same way okay you have to resize the graph and you know and then you have to block plot it okay plot a line chart a line graph okay and then you have to add title labels okay to your labels okay and legend to your graph you do it and i give this to you as an assignment i hope you have understood this okay you can add and you can you have to save it also okay i just told you what is save pld dot save figure they say fig is the way how do you the way you save the figure in your folder okay can you do this so let me give this to you as the first assignment of the day okay and save the graph can you all do it as an assignment yes all of you yes see what is the difference between tick and label so label is nothing but x-axis is given a label that name x-axis this is the label y-axis is the label but in that axis these are the uh points okay the spread of that what you call uh the scale of that axis is what is given by u you can scale it or you cannot scale it if you do not scale it by default it will take the values corresponding to x and y understood the difference between takes a label prativa did you understand the difference between text and label tick is nothing but the data points okay or the scale or the units that you are customizing and adding in the particular axis that is what is called ticks label is nothing but x-axis and y-axis is given a name okay so is it height versus weight suppose in x-axis if i give the the the label as height and y-axis its weight height was so height and weights are nothing but labels i hope you understood okay now moving on to the next one you have to install okay this is the first primary thing that you have to do is for people who have joined in between you have to load the libraries and then you can start in so this is all this was all about line chart okay we'll do another one okay so this is the assignment for you assignment for the day okay you'll have to plot this simple line chart okay the assignment number one okay now the next one okay uh so you have to also i think you have also uh downloaded this numpy library right numpy is nothing but it's for uh numerical operations okay so numpy like this it is all with you know uh numerical function so numeric it's all about numbers numpy library okay so you can use it for calculation scientific calculations etcetera so here you what you do x 2 equal to okay you're just plotting now if you have to do two line charts okay two line charts and then do it so it's the same thing see x two equal to np dot a range zero to four okay so if you print x 2 it will give you 0 to 4 it will not be till 4 okay and in steps of 0.5 ok 0.51 1.5 like this ok so now for x 2 we are see earlier you saw right so let me plot this again this was the earlier plot okay the one which we just saw this is what was the earlier plot now i am including this plot also we are doing another line plot inside the same plot so here what is x x is nothing but this thing this particular okay 1d array or list okay this is what it is 0 these are the values that you are giving okay zero zero point five one one point five and then y is nothing but x two to the power two okay x two this particular values to the raised to the power so if you see this you can add a code here so you can just print what is x2 2 okay okay so again you see so raised to the power 2 okay so it's square square okay it's like whole square so 0 square is 0 0.5 the whole square is 0.25 1 square is 1 like that okay so it's x x square x 2 the whole square okay so that's why and then again you are giving a color okay you can giving a color to it and then let's plot this okay now as you see i have given the label also so x square x raised to x okay x square so this is the label okay now see you can you have got two different plots right which are uh in the same in the same figure you have got two different plots so this is just to show you that okay let us move on to the bars okay bar chart so here let's uh do this bar chart okay initially you can just put this okay you can add some labels to your butter so as i told you bharta are nothing but these are rectangular uh you know rectangular diagrams which we've been wearing each and every variable the length of the variable is length of the bar shows the value okay so if you just put it okay you can give any label to it you can give anything to it and you have to give a value also subsequent value so the number of labels and the number of values should be the same so this is the bar chart okay and then you have to give plt dot bar okay always give labels first comma values next okay this is a single bar chart okay and this given enter and this is what you will see okay so the a what is the value of a 1 value of b is 4 and the value of c is seven okay so in order to avoid this line you give you you can put a p l t dot show and give an n now again the way we did the previous uh plot the same you can add a title to it you can add a you know axis name and everything okay not access name you can add title to it okay so here ok now let us beautify this particular have you all done till here let me just keep a pause and just ask you line chart is done i've given you an assignment also okay you will have to uh you know consider these two x and y and then resize it plot it add a title label legend to your graph and then save the graph okay this is the first assignment so we have completed line plot and we also know multiple line plots how do you do okay so you can understand this you can again beautify it here i have not added any title i have not added any labels but you can do it can you do it please give me a thumbs up in your chat if you can do it please all of you give me a thumbs up if you yes yes yes super yes yes and what somebody asked me what is the difference between a range and a range a range is nothing but you are you if you just give np dot a range it will just display it as an array okay 1d array of you know if you'll be 0 to 10 okay it will display you 0 to 9 okay so you can just create arrays using a range range is nothing but it's just a general term what is the range of values maximum and minimum range so that is what is called a range a range is nothing but it's just specifying what is the what when you're creating an array that's what and using numpy library np dot a range so you create a array by specifying the start point and the end point and you can also specify the step if you are not specifying the step by default the step size will be plus one okay so you can either give a positive number or you can give a negative number all right very good so let's go on to the bar chart okay so this is a basic bar chat if you just want to keep it like this it's enough okay but then if you want to add colors to it and different things okay let's do that also okay so here so it's the same bar chart that we did okay just now i just showed you have added labels you have added values to it and then you're just putting plt dot bar and then always put labels first okay what will you give get if you put values first you'll let's see that also okay see it's nothing it's not clear at all okay so you should always put x such labels first and then y is nothing but values okay x is label and y is value okay now to a bar chart also you can add a lot of things now for every bar you can add a color or you can even you know you can set these you know what pattern you want okay so it's nothing but dot set underscore hatch now this plt dot bar okay i have defined i have i have e okay i have assigned this to this particular plot is named as bars so bars of 0 the first bar that is 0 can be given a pattern like this slash symbol okay the uh i mean this starts with zero okay so this is nothing but bar zero this is one this is two okay it starts from zero then the next bar can be given set underscore hatch is nothing but the pattern okay let's see how this looks let's see so it's different right so you can uh put this symbols okay these patterns in order to add beauty to it okay and again the if you don't want this the other way is you can add patterns to it and then you can give so patterns equal to slash and then these three patterns and then for bar and bars you can set so it's nothing but it's a for loop okay so when it is 0 when bar is 0 this is that if bar is 1 this is set so if you if you want to use okay it's the same thing okay so control slash and again let me show you this also so patterns these three patterns you're just putting it as a variable patterns equal to you again you're giving the list of patterns and then you're you're putting a for loop here for f for bar and bars okay bar dot is instant the same thing okay dot set underscore hatch these patterns dot pop of zero okay so it will start from zero again if you shift enter it's the same thing so whichever you're comfortable with you can do it okay any doubts in bar chart and then we'll move on to a real data set okay can we move on to a real data set all of you i also wanted to tell you show you about a scatter plot let me show you a scatter plot okay okay so yes so here you have uh you can download there are [Music] okay so see suppose you have this you don't have to do right now okay you have a data set of flowers okay ah iris flower and this flower this particular data frame it has every flower okay there are i think 150 uh flower each each and every record in this data frame is nothing but one flower so for every flower that is the flower is nothing but i think it's uh there are four different species of flower okay and each flower is uh you know the value for each flower for each observation of each flower the different values that i entered are for sample length sample with petal length and petal width okay so for zero the first flower the sepal length is so based on this they have identified what species of flower it is okay serosa there are four different kinds of flowers in this particular data set okay i this data set is called iris data set i think i would have loaded it somewhere uh yeah so setosa virginica so this is that iris data set okay so if you so this is the iodis data set okay so you can see the species okay what type of flower it is i just want to show you how a scatter plot looks like so that's why i came here so this is nothing but bf is the data frame dot plot dot scatter this is all you have to do and then i told you when i initially told you what is a scatter plot it is to it is to plot two different variables x is a variable y is a variable so you can give what x is x sample length uh and you know y should be a sepal width or something you can give anything okay any x okay so how is a sample length and sepal with how is it varying you can just plot it so this is one variable and this is the other variable so this is what is a scatter plot okay so x is a variable y is another variable okay and then you can see the variation did you all understand how a scatter plot looks so it's as simple as put the data frames name dot plot dot scatter you don't have to download anything extra you just have to put just like the way we did plt dot bar plt okay the earlier one pld dot plot plp dot bar similarly you have to put plt dot scatter okay and then x is a variable y is another variable did you all understand scatter plot you don't have to do this because you'll have to download the iris data set and the way you have to download ios data set is let me tell you how to do it okay so this is how you do it okay let me put it here okay but uh before we start the next one okay so you can put import c bond as sns you shift and enter so this is the package okay and then you can give this i n is equal to sns dot load data set iris and this given enter okay so you will have this okay iris dot head okay and then you can give iris this is the data flip dot plot dot scatter okay and then you can give what what what do you want the x to be this will underscore length and be very is careful when you are giving these values okay the name should be these these are very case sensitive so okay comma y equal to what is this is nothing but so let me let's keep it as length itself okay petal length so this is also scatter plot okay better okay so if you see x is under exercises every point denotes what so what do you infer from it so as sample length increases petal length also in certain flowers so these this is this shows the relation okay so in certain flowers simple length is also so here you can see for this particular record here the simple length is also more on the higher side and petal length is also higher okay so a majority of the flowers you can see what is what in what is in what range does it fall okay or you can hide it for these are the records wherein the sepal these are the flowers or these many other records wherein the sample length varies from say 4 to 5.8 but the sample length is so much but the petal length range is only between 1 and 2 okay so these are the things that you can ensure and majority of the records for majority of the flowers the sepal length falls between what 5.5 to 7 okay and the petal length is between say for example 3.5 and 6. so these are the things that you can understand okay so this is a scatter plot i hope you understood please give me a yes if you have understood all of you so the way you have to download the inbuilt data set is nothing but sns dot load underscore data set okay yes so so far what all you have seen we have seen what is a data visualization okay how uh how is it done why is it done what are the different libraries what are the different charts okay so this is what you have done and then yeah let's go on to histogram okay histogram histogram is nothing but it's in the form of bins okay for example for that we'll have to download a data set okay so this is a fifa data set okay i'll tell you how to how do you do that okay suppose if you go to uh so this is a pandas library okay you can load the data set in it's in csv format so if you go to this particular site okay so let me open it and show it to you ctrl c ctrl v okay so in github okay if you see this okay okay here if you see macbook tutorial okay this fifa okay so you go to github and you type in uh the whichever okay the data that you want and then see this is it's in the form of csv file okay any data set okay and then you can just copy paste this url into here okay so this is how i have done and you should always view it in raw format so you have to you will have this view raw okay so this is a csv file you can either download it or you can just view it raw okay so you just download this url and this is a fifa [Music] data set it's a real data set okay of different players with their names id okay the photo nationality okay so the football players the clubs okay so there are different methods to this thing the club the club logo preferred foot okay each football player what is the preferred foot now quickly before that okay uh see there's something called overall here okay because that's what we uploaded see overall performance is plotted see 94. so for every player what is the performance okay so how many are there okay so right now we have uh okay we are just visualizing five but then here see if you just give this plot okay his test is nothing but histogram okay so df2 is nothing but we have loaded the data set and this using pandas library we have loaded the data set and given the data from our name called df2 okay so and here we are just plotting a histogram okay let's see how the histogram looks like this is the basic histogram okay distribution so distribution so how many players number of players with performance range between 60 and 70. so between that particular range how many players this is so we'll continue histogram tomorrow i think it's almost time up all right so we'll continue from histogram tomorrow we'll continue matplotlib tomorrow okay so as of now as of today we have just seen what uh what is data visualization and line chart bar chart and scatter plot okay i'll upload the assignment okay and uh i hope to see you in tomorrow i hope to see all of you in tomorrow's session so before we log off um can you please give me the whether you understood something from today's class i hope if somebody asks you what is data visualization you'll be able to tell them explain it to them yes or no yes all of you all to all the students who are right now viewing this particular session please give us thumbs up you have you have a basic idea of what a line chart is what a bar chart is and what a scatter chart is yes yes yes again extremely thank you so much okay and yes okay okay so among the students who are right now present if you have plans to pursue a full time post graduate program in airml or in data science you can please uh you know enroll yourself or register your self contact your let's upgrade all right and you can enroll for in case if you have such plans you can go through the curriculum and you can uh enroll yourself for a full-time uh pgp course okay okay so the uh the today's course will be uploaded the assignment will also it's also a part of it so there's just one assignment that i've given you today okay so thank you so much i hope all of you uh you know we can see tomorrow's session tomorrow same time we will continue matplotlib okay and then we'll move on to seabot okay so take care have a great day okay i hope you liked the session thank you so much
Info
Channel: LetsUpgrade
Views: 2,875
Rating: undefined out of 5
Keywords: certification, essentials, Batch2, LetsUpgrade, certification Program, E-learning, career, course, Technology, Upgradeskills, Python, Developer, Django, Project, Doubt clearing, python project, python project tutorial, py, python project for beginners, python from scratch, learn python from basics, python basics
Id: -28pHBx-NiM
Channel Id: undefined
Length: 88min 53sec (5333 seconds)
Published: Thu Sep 16 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.