Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

function for getting the basic statistic of our Dataframe in one go

#Creating a function that does all of the above tasks in one go:

def get_basic_stats(dfname):
    print("Shape of dataframe is " + str(dfname.shape))
    print("Below are datatypes of columns in DF")
    print(dfname.dtypes.sort_values())
    print("Below are missing values in each column")
    print(dfname.isna().sum().sort_values())
    print("Below are percentage of the missing values in each column")
    print(dfname.isna().sum().sort_values(ascending=False) / len(dfname))
    print("Below are the number of unique values taken by a column")
    print(dfname.nunique().sort_values())
    print("Below are some records in DF")
    print("Below is distribution of numeric variables")
    print(dfname.describe())
    print(dfname.head())
    
    
get_basic_stats(df) #df here is the dataframe we wants to get it's statistic
Comment

PREVIOUS NEXT
Code Example
Python :: how to install python on linux chromebook 
Python :: Horizontal stacked percentage bar chart - matplotlib documentation 
Python :: Read a string with digits from the input and convert each number to an integer. Create a list in which you should include only odd digits. 
Python :: The most appropriate graph for your data 
Python :: pd.generate_date 
Python :: call static method from another static method python 
Python :: install mangadex python 
Python :: fix the error when you close turtle screen in your own main loop 
Python :: python print install directory 
Python :: send notification from pc to phone using python 
Python :: Combine first and last 3 columns into new dataframe 
Python :: How to draw a Ninja Design using python turtle 
Python :: windows py SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate 
Python :: pandas fast way to view distribution by group 
Python :: python nc group variables 
Python :: how many python programmers in the world 
Python :: python multiline code dot 
Python :: picobot python 
Python :: gpt2 simple restore_from 
Python :: how to select name parent table in model laravel 
Python :: how to tokenize a dataframe in python csv 
Python :: visual studio code python indent shortcut 
Python :: pandas typr of each cell in series 
Python :: getting player input python 
Python :: Returns the cartesian product with another DataFrame 
Python :: pip img2pdf 
Python :: drop duplicates pandas considering lowercase 
Python :: install formio data python library 
Python :: pyttsx python not working 
Python :: python to exe converter online 
ADD CONTENT
Topic
Content
Source link
Name
4+6 =