REVISION CLASS 12TH

 


max() 

It returns the maximum value from a column of a data frame or series. Syntaxdf[‘columnname’].

max()

 Or 

df.max(axis=0)         returns the maximum value of every column 

Or

 df.max(axis=1)             returns the maximum value of every row


min() 

It returns the minimum value from a column of a data frame or series. 

Syntaxdf[‘columnname’].

min() 

Or 

df.min (axis=0)                     returns the minimum value of every column 

Or 

df.min(axis=1)                 returns the minimum value of every row


count()

 It returns the number of values present in a column of a data frame or series.

 Syntaxdf[‘columnname’].

count() 

Or 

df.count(axis=0)                     returns the number of value in each column

 Or

 df.count(axis=1)             returns the number of value in each row


mean() 


It is used to return the arithmetic mean of a given set of numbers, mean of a data frame, mean of a column, mean of rows. 

Syntaxdf[‘columnname’].

mean()

 Or 

df.mean(axis=0)                         returns the mean of each column 

Or

 df.mean(axis=1)                     returns the mean of each row


sum() 

 It is used to return the addition of all the values of a particular column of a data frame or a series . 

Syntaxdf[‘columnname’].

sum() 

Or

 df.sum (axis=0)                 returns the sum of each column 

Or 

df.sum (axis=1)                 returns the sum of each row


median()

 It is used to return the middle value or median of a given set of numbers, median of a data frame, median of a column, median of rows. 

Syntaxdf[‘columnname’].

median() 

Or 

df.median(axis=0)                     returns the median of each column 

Or 

df.median(axis=1)                 returns the median of each row


mode() 

It is used to return the mode or most repeated value of a given set of numbers, mode of a data frame, mode of a column, mode of rows. 

Syntaxdf[‘columnname’].

mode()

 Or 

df.mode(axis=0)                 returns the mode of each column

 Or 

df.mode(axis=1)                 returns the mode of each row




Renaming index rename ()



 method is used to rename the indexes in a data frame.


 Syntax- df.rename ( index, inplace (optional))


Deleting index


 reset_index().drop() method is used to delete the indexes in a data frame.


 Syntax:- 

df.drop( index, inplace =ture/false)


Use of attributes .at and .iat 

df.iat: 

the dataframe provides a property iat[] to access the single values from dataframe by their row and column number. it is similar to iloc funtion tha provides index-based access to the elements in a dataframe. 

the only difference is that it returns a single value at the given row and column number from the dataframe.

SYNTAX:-

dataframe.iat[row_number, column_number]


df.at:-

it is similar to the loc function which provides label-based accessing of the elements but only difference is that it allows to access a single value only based on row/column label pair from a dataframe

DATAFRAME.AT[ROW-LABEL,'COLUMN_NAME']



Post a Comment

0 Comments