Header Ads Widget

Responsive Advertisement

CBSE Class 12 Pandas Series Attributes | Code 065


Dear students in this article we will discuss about the important attributes of the pandas library. In previous article we also discuss about the the pandas and its data structure Series. How we define series? How do you define a series in pandas? What is series in Python with example? How do you define an empty series in Python? How do you create a series in a list in Python? python series example we can analyse the data in pandas with pandas series example python series to list python pandas series programs python series create pandas series pandas series get value. Now we will discuss important attributes of the of series like values, index, dtype we will discuss what is the output of particular attributes

 
.
Attribute Explanation
Series.values Return Series as ndarray or ndarray like depending upon dtype
Series.index Range of the index (axis labels) of the Series.
Series.shape Return a tuple of the shape of the underlying data.
Series.dtype Return the dtype object of the underlying data.
Series.size Return the number of elements in the underlying data.
Series.ndim The number of dimensions of the underlying data, by definition 1
Series.nbytes Return the number of bytes in the underlying data.
Series.hasnans Return True if Series has any nans; enables various perf speedups.
Series.empty Return true if Series is empty





Series.index 
This attribute is used to get the range of the index (axis labels) of the Series. Let us try this function on the student Series.

Series.shape 
shape attribute gives the shape of the underlying data structure in the form of a tuple. Since the student Series is having 4 elements the output is (4,).

Series.dtype 
dtype attribute is used to check the data type of the Series Object. Since the student series is of object type, below output is showing 'o'.

Series.values 
values attribute returns Series as ndarray or ndarray like depending upon dtype.

Series.nbytes 
nbyte attribute gives the total number of bytes taken by the Series object to store the data. The below-given output tells that the student object takes 32 bytes of memory.

Series.ndim 
ndim gives the dimension of the underlying data structure. Since series is a 1-D data structure, for all series object it gives 1.

Series.size 
size gives the total number of elements in the series. Since the student series has 4 elements size will give 4.

Series.hasnans 
hasnans returns Boolean value. If any of the series elements is NaN it will return True. Otherwise false.

Series.empty 
empty attribute returns Boolean True if Series is empty, otherwise the output will be False.








Post a Comment

0 Comments