CBSE CS and IP

CBSE Class 11 & 12 Computer Science and Informatics Practices Python Materials, Video Lecture

Pandas DataFrame Methods

Pandas DataFrame Methods (Important)

  • As we all know everythin in python is Object. Every Object has some Methods and Attributes.
       Methods - Functions (Ex:- add() )
       Attributes -  Properties (Ex:- dtypes,loc, iloc, at, iat )
  • Assueme if we have created a DataFrame df, then the Methods and Attributes will be used with df as follows.
       Methods - df.add()
       Attributes -  df.dtypes
  • Methods used with small brackets [ () ], but the attributes will not be used with bracjets.
  • Following are the important methods of DataFrame. 

Click on them to find how to use them with example (After opening the link find the dataframe examples) :

  1. abs( ) : Return a Series/DataFrame with absolute numeric value of each element.
  2. add( ) : Get Addition of dataframe and other, element-wise.
  3. div( ) : Get Floating division of dataframe and other, element-wise.
  4. sub( ) : Get Subtraction of dataframe and other, element-wise.
  5. sum( ) : Return the sum of the values for the requested axis.
  6. floordiv( ) : Get Integer division of dataframe and other, element-wise
  7. equals( ) : Test whether two objects contain the same elements.
  8. all ( ) : Return whether all elements are True, potentially over an axis.
  9. append( ) : Append rows of other to the end of caller, returning a new object.
  10. astype( ) : Cast a pandas object to a specified dtype
  11. copy( ) Make a copy of this object’s indices and data.
  12. describe( ) : Generate descriptive statistics.
  13. drop( ) : Drop specified labels from rows or columns.
  14. drop_duplicates( ) : Return DataFrame with duplicate rows removed.
  15. dropna( ) : Remove missing values.
  16. fillna( ) : Fill NA/NaN values using the specified method.
  17. replace( ) : Replace values given in to_replace with value.
  18. rename( ) : Alter axes labels.
  19. reindex( ) : Conform DataFrame to new index with optional filling logic.
  20. reindex_like( ) : Return an object with matching indices as other object.
  21. rename_axis( ) : Set the name of the axis for the index or columns.
  22. set_index( ) : Set the DataFrame index using existing columns.
  23. where( ) : Replace values where the condition is False.
  24. max( ) : Return the maximum of the values for the requested axis.
  25. min( ) : Return the minimum of the values for the requested axis.
  26. mean( ) : Return the mean of the values for the requested axis.
  27. median( ) : Return the median of the values for the requested axis.
  28. std( ) : Return sample standard deviation over requested axis.
  29. var( ) : Return unbiased variance over requested axis.
  30. count( ) : Count non-NA cells for each column or row.
  31. agg( ) Aggregate using one or more operations over the specified axis.
  32. head( )Return the first n rows.
  33. tail( )Return the last n rows.


1 comment:

  1. thannnk youu!!!
    it was worth it for last moment reference

    ReplyDelete