How to plot Bar Graph of a csv file | Python | Machine Learning

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
foreign [Music] bar graph of CSV file okay so till now you have learned how to build a model for CSC file how to read CSV file how to describe CSV file and all the functions uh regarding CSD file but how to plot a CSC file how to visualize our data so in this particular video we are going to learn this okay so this is a CSV file uh mushrooms or CSP I have uploaded from our uh local uh local memory local computer okay so this is the file I have uploaded and we are going to uh see the thought the bar graph of mushrooms or CST file okay so let's uh import the necessary libraries like import panda is a very necessary library for reading the file so important SPD and for uh visualizing it or for making a figure we have to import a new library import is a library which is used for plotting or visualizing the data okay so yeah these are two libraries we have imported and the second step is uh like firstly you have to read your data so you have to just write DF Dot uh PD dot read CSP this is a function you already know and we here give the path of this file okay so here we give copy path and give the path of this file okay if you want to see the structure of this file you have to just write DF dot head these are all the functions so so yeah sorry for that yeah so this is a file these are all the columns and uh there are five rows and 23 columns are there because head function returns of only five rows top most five rows and 23 columns are there okay if you want to see how many total rows are there you have to just type DF dot info it gives all the information about this data set so there are 8 124 rows okay from zero to eight thousand one hundred twenty three rows index okay and these are 22 columns sorry 23 columns including the zero zeroth index okay yeah so the next step is plotting a bar graph okay so for this you have to just write um um Delta is equal to PD dot data frame so okay you convert it into Data frame sorry here it is PD for fund our library data frame and provide this DF here okay so that data converts into Data frame if you want to see the structure of data you have to just write data okay now you can see and if you want to see the uh okay if you want to see the structure of the whole information about data you have to just write DF dot info and here it is the same because it is the same and we just converted our CSC file into Data frame okay so this is not necessary and for plotting uh this we have to just write the fake is equal to PLT Venus lies this PLT dot figure okay okay yeah and then we write uh we Define excess so you have to just write fit Dot add excess here you provide the values firstly I provide 0 from a 0 comma 0.5 yeah some values whatever you want you have to provide it okay so yeah we have to provide and then we Define X and Y axis so for defining X and Y axis you have to just write X is equal to list and here d f Dot ilock note here we Define data yeah so this is a data now so yeah here we write data okay data dot High log yeah data dot I log and here from the First Column zeroth okay this is uh x axis and for y axis we write the same list data dot I log and here you we provide one okay and we have to just write as x dot bar for making a bar if you uh run this only code then you yeah okay and if you run it X Returns the this x is okay so for this you have to just write here X is dot bar for making bar graph X comma y comma color if you want to give any color here I give blue color so I just provided B okay and here I write PLT dot show uh show okay yeah so uh this is a line we have to uh we have to write in the same cell only okay so this is a this is the size of our old uh 23 columns because we provided you very less value 0.5 that's why very close so here we have to write just 1.0 then see so the length of this is now clear okay the column name the column names are clear but rows names are not clear so for this you have to just write here uh 1.5 yeah so it it have a breadth more than a previous so for uh clearly visible for clearly visible we have to just provide more uh with like I am going to provide here six point okay okay yeah now you see and here if you want to see here also you provide 6.0 so now you see the graph and this is a graph of your rows like now you see here the class these are the column names Class Type shape these are the traditional columns are there in the x-axis and in the y axis these are also the columns are there and this is a biogram bar graph for this so I think now you are able to design bar graph of any data set any CSP file whatever the number of rows and number of columns are there like here you see there are 8 124 rows and 23 columns are there so we have just plotted the graph and dependent on your data you have to give the values okay so yeah till now take care bye bye and give your best [Music]
Info
Channel: Knowledge Bustle
Views: 5,263
Rating: undefined out of 5
Keywords: Knowledge, Educational, Bar graph, machine learning, colab, csv file, pandas, matplotlib, plot
Id: I2FUFdKcJYU
Channel Id: undefined
Length: 8min 1sec (481 seconds)
Published: Fri Dec 02 2022
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.