ATTRIBUTES OF SERIES IN PANDAS - PYTHON PROGRAMMING

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] hello friends welcome back to our channel so in today's session we will going to discuss about various attributes that gives the information about the series in partners so in the previous session we have seen how to create the series how many ways we can create a series in pandas now we'll see the different attributes that gives the information about the series in partners so attributes attributes first attribute is the index index and the syntax is series dot index so this will give the index values it will return all the index values okay all the index values so that index values can be either zero from starting from the zero that means the numerical or which you have given so while creating a series we can change the index values right so those index values will be returned by using this attributes we can know about those index values which type of index given for the series and second one array attribute array so this the syntax is series dot array which will return return an array of values so whatever the elements we are giving in the series that will be given in the arrays array of values right and the third index i mean third attribute is the values values so we know that the series will be having a value so we have to give the values in terms of uh array or a list right so that values will be written the syntax is series dot values it return values of series so don't no need to worry i will execute each and every attribute and i will explain right so the next one is name name so by creating the series we can also give a name for the series so if you give the name so this is an optional okay this is an optional so we may give or we may not give but if you specify any name for the series that name will be written here if you are not specifying any name for the series nothing will be printed here okay so the syntax is same common that is a series dot name it returns name of a series name for the series which we have given and the next one is a shape so it will give the shape of that particular series whether it is a n dimension or what is the shape okay how many elements will be there and all these things will be given so here the syntax is series dot shape so it returns the shape of the series returns the shape okay it returns the shape i will show you by executing these attributes right so then you will be understanding about all these things and there is a ending attribute called ending which will give the dimension of that particular series dimension whether it is a one dimension or it is a multi-dimension okay the syntax is common that is series dot n beam it returns the dimension dimension of series the given series and the size size so this size attribute will return the number of elements in the series number of values in that particular series okay so the syntax is a series dot size it returns the size of a series that means the number of elements available in that series size of series and the next one is n bytes n bytes so the syntax is series dot n bytes which will return the memory occupied by the values okay the memory occupied by the values so this you just remember returns the memory occupied by values memory occupied by values okay and then the next one is a memory underscore usage function memory underscore usage function so this is a function right and the syntax is series dot memory underscore usage so this returns this returns memory occupied by both index and values both index and values okay both the index and values so we know that if you create any series automatically the index values will be joined so all the elements will be indexed with some index values so by default those index values will be from 0 to something starting with the 0 and if you if you want to change the index we can specify by using the index parameter so here the memory usage function is used to return the memory occupied by both the index and values both the index and values but here n bytes but here n bytes it will return the memory occupied by only values it will exclude the indexes okay it will exclude the index it will check only for the value right next empty so this is a boolean attribute so series dot mt series dot mt and it returns true if series is empty that means if series doesn't have any values and it returns false if series is not np that means if the series consists of any values then automatically it will return false so this is a boolean type okay this is a boolean type right so these are the few attributes these are the few attributes which gives the information about the series like the index errors uh values name shape dimension size memory occupied by the values and memory occupied by the index and values and empty empty right so let us move on to the interpreter and we will see these attributes one by one okay first we have to create a series and we can find the different attributes based upon the different attributes we can find the information about that particular series and this we will see on the interpreter so let's move on to the interpreter hello friends so just now we have seen various attributes available in pandas so series in pandas so we'll see one by one the attributes so how it will be working so for that we will just import the pandas import pandas i will give some alias name so that we can call all these things with the alias name so first of all let us create one series some s is equal to pd dot series yes capital s series and we can create a series in different ways so that we have already discussed in the previous session so you can go through that session and you can create a series so i will create with a normal list okay some 50 and i will give you some name we can also give the name for the series okay let it let it be numbers and also we can change the index values so if you are not giving any index attribute here so by default it will be taking as a zeros see so print if you print yes we can get the index values from 0 to 4 so if you just want to change the index values we have to give the index attribute so there is a one attribute called s dot index so it will give what actually the index refer to the values so here you can observe s dot index s dot index will give the values from 0 to 5. and if you change this one if you change this one so index is equal to and if you go with the a b c d e right so there are five indexes okay so i'm taking like this and now i just if i execute this s dot index now we will get the result as abcd so it will return the index values for the given values okay index of given values right next one is a array so s dot array will be representing the elements in terms of arrays so you can observe so this is an array pandas array okay pandas array so 10 20 30 50 and the length of the array is 5 and d type is in 64 in 64. and values if you want to get only values without any index value let's go with the s dot values so it will return only the values but not the indexes it will return only the values but not the indexes and similarly if you want to know the data type for this one so go with the s dot d type it will give the data type of the given values see let us check once again we will change the another into another data type so 10.5 point 20.5 30.5 some 40.5 and 50.5 and here the name i am also changing the name as some float okay some float now let us check s dot a s dot d type s dot d type will give a float okay so previously s is having some integer and now the s is having some float values float values and we can also find the shape so what is the shape of this ah a series sorry s dot shape so we will get only one dimension so there is one more attribute called ending ending gives the dimension so dimension of this series is only one dimension so that's why we are getting some only five so that implies one dimension and e that dimension is having only five elements one dimension with the five elements right so we have already seen this shape of shape values in numpy right and ending after ending we can also find the number of bytes number of bytes okay so s dot n byte sorry sorry s dot n bytes okay and bytes so it will give how many bytes occupies by the values how many bytes occupies by the values and there is a one more thing called a memory see i will will show you the difference memory underscore usage so what is the memory usage of that particular series okay of that particular series so s dot memory usage is 156 so here the s is having only five elements so here also s is having only five elements what what is the difference means so yes dot memory usage will include the index values also it will include the index values also so you can observe in the if if there is an attribute there is an attribute called index if you give a false to that index it will give only the memory occupied by the values itself so that's what 40 okay n bytes will return the memory occupied by only the values memory usage function will return the memory occupied by both the values and index and if you give the false value for the index attribute in the memory you say we'll get the memory occupied by only the values so this is a 40 okay and also we can find the size so s dot size the size of particular series size of particular series so we know that yes is having some five elements so size of that particular series is five and also we can get the name name of the series so s dot name is equal to float so we have given already right previously we have a given some name is equal to float right name is equal to float so that's why if you go with the s dot name we'll get it is a float we'll get as a float right and then empty so s dot empty it will check whether the series is empty and if it is empty we get a true and if it is not empty we will get a false so we'll get a false because s is already having some five elements this is having already five elements now let us check so s one is equal to p d dot series of just give that one so yes one if you print s1 sorry s vs1 will get an empty series we will get an empty series so s1 dot size is equal to 0 because there are no elements we have just created a series but we are not having any elements in that series so in this case if you check with s1 dot md we'll get the result as true because s1 is empty because s1 is empty right so like this we can apply we can check all the information of that particular series by using these attributes right so hope you understood this uh attributes so if you are having any doubts regarding these attributes so feel free to post your doubts in the comment section so that definitely will try to clarify all your doubts and if you real understood my session like my session share my session with your friends and don't forget to subscribe to our channel thanks for watching thank you very much
Info
Channel: Sundeep Saradhi Kanthety
Views: 4,122
Rating: 4.8909092 out of 5
Keywords: sundeep, saradhi, kanthety, python, programming, basics, fundamentals, programming concepts, import, programming fundamentals, PYTHON PROGRAMMING, PYTHON FUNDAMENTALS, interpreter, python libraries, libraries, numpy, pandas, numpy installation, libraries installation, install and uninstall, PANDAS, idle, anaconda, series, dataframe, panel, lists, series creation, pandas series, array, attributes, values, ndim, memory usage, shape, size, nbytes, dtype, index, name, empty, series attributes
Id: En8LbtBvS_8
Channel Id: undefined
Length: 15min 11sec (911 seconds)
Published: Fri Oct 16 2020
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.