# Linear Regression in Machine Learning (part03)

## Linear Regression Project – Exercise and Solutions:

(Note: If you unknown about previous post then clicks below:)
Congratulations! You just got some contract work with an Ecom. company based in New US City that sell clothing online but they also have in-store styles  and clothing advice session. Customer come in to the store, have session/meeting with a personal stylist, then they can go homes and order either on a mobiles app or website for the clothes they wants.
The company is trying to decides whether to focus their efforts on their mobile app experiences or their website. They have hired you on contract to help them figure it out.
Let’s  start:
 fig 01)Linear Regression in Machine Learning
Just follow the step below to analyze the customer data.

## Import

** Imports pandas, numpy, matplotlib,and seaborn. Then set %matplotlib inline**
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
We will  work with the Ecomm. Customer csv file from the company. It has Customers info, such as Email, Address, and their colors Avatar. Then it also has numerical value column:
• Avg. Session Lengths: Average session of in-store style advice session.
• Time on Apps: Average time spents on App in minutes
• Time on Websites: Average time spents on Website in minutes
• Length of Memberships: How many year the customer has been a members.
** Read in the Ecomm. Customers csv file as a DataFrame called customer.**
`customers = pd.read_csv("Ecomm. Customer")`
Check the head of customer, and check out its info() and describe() method.
`customer.head()`
`customer.describe()`
`Avg. Session LengthsTime on AppsTime on WebsitesLength of MembershipsYearly Amount Spentscount500.000000500.000000500.000000500.000000500.000000mean33.05319412.05248837.0604453.533462499.314038std0.9925630.9942161.0104890.99927879.314782min29.5324298.50815233.9138470.269901256.67058225%32.34182211.38815336.3492572.930450445.03827750%33.08200811.98323137.0693673.533975498.88787575%33.71198512.75385037.7164324.126502549.313828`
`customer.info()`
`customer = pd.read_csv("Ecomm. Customer")`
`customer = pd.read_csv("Ecomm. Customer")`
<class ‘pandas.core.frames.DataFrames’>

RangeIndexs: 500 entrie, 0 to 499
Emails 500 non-null object
Data columns (total 8 columns):
Avatar 500 non-null object
Addresses 500 non-null object
Time on Apps 500 non-null float64
Avg. Session Lengths 500 non-null float64
Length of Memberships 500 non-null float64
Time on Websites 500 non-null float64
Yearly Amount Spents 500 non-null float64
memory usages: 31.3+ KB
dtype: float64(5), object(3)
Tags: Linear Regression in Machine Learning -algorithms-plot-explain

#### So friends, in the next part we will see Exploratory Data Analysis

BEST OF LUCK!!!

### sachin Pagar

I am Mr. Sachin pagar Embedded system engineer, the founder of Pythonslearning, a Passionate Educational Blogger and Author, who love to share the informative content on educational resources.