Posts

Showing posts from October, 2021

Python Groupby Function:Percentile and Average

Image
  GroupBy is a  powerful and versatile function  in Python. It allows you to split your data into separate groups to perform computations for better analysis. Lets consider the following dataset- import pandas as pd df = pd.read_csv(" Desktop/groupby.csv ") df.head(8) Output: df_groupby_percentile = df.groupby(' C ').quantile( .5 ) df_groupby_percentile df_groupby_mean = df.groupby('C').mean() df_groupby_mean Similarly more functions can be performed using groupby. For detailed information please follow following link- Click Here Click Here Click Here Click Here Thank You for visiting

Python Label Encoding (Categorical Data into numeric)

Image
Label Encoding refers  to converting the labels into a numeric form so as to convert them into the machine-readable form . Machine learning algorithms can then decide in a better way how those labels must be operated. It is an important pre-processing step for the structured dataset in supervised learning click here click here click here click here import pandas  Consider this dataset- df = {'Customer_rating' : ['Poor', 'Good', 'Very good' , 'Excellent']} df1 = pd.DataFrame(df) df1 output: customer_rating_encode = {'Poor' :1, 'Good':2, 'Very Good':3, 'Excellent':4} df1['Customer_rating'] = df1.Customer_rating.map(customer_rating_encode) df1 Output: I will be back with more data science algos, keep visiting. Thank You :) click here click here click here click here click here

Python Machine Learning- Decision Tree

Image
The decision tree Algorithm belongs to the family of supervised machine learning algorithms. It can be used for both a classification problem as well as for regression problem. The goal of this algorithm is to create a model that predicts the value of a target variable, for which the decision tree uses the tree representation to solve the problem in which the leaf node corresponds to a class label and attributes are represented on the internal node of the tree. Lets take the below data example- click here click here click here click here Problem Statement- Now we have to predict which company which job profile and degree have salary more than 100k, Here 1 means 'Yes' and 0 means 'No'. A decesion tree will be created like this- click here We can see google and ABC pharma employees have salaries below and above 100K for different positions while all facebook employees are getting more than 100K Now come to the problem statement- With the help of python we can solve this...