Congratulations! You just got some contract work with an Ecommerce company based in New York City that sells clothing online but they also have in-store style and clothing advice sessions. Customers come in to the store, have sessions/meetings with a personal stylist, then they can go home and order either on a mobile app or website for the clothes they want.
The company is trying to decide whether to focus their efforts on their mobile app experience or their website. They've hired you on contract to help them figure it out! Let's get started!
Just follow the steps below to analyze the customer data (it's fake, don't worry I didn't give you real credit card numbers or emails).
In [275]:
We'll work with the Ecommerce Customers csv file from the company. It has Customer info, suchas Email, Address, and their color Avatar. Then it also has numerical value columns:
Read in the Ecommerce Customers csv file as a DataFrame called customers.
In [276]:
Check the head of customers, and check out its info() and describe() methods.
In [277]:
Out[277]:
In [278]:
Out[278]:
In [279]:
In [280]:
In [281]:
Out[281]:
Do the same but with the Time on App column instead.
In [282]:
Out[282]:
Use jointplot to create a 2D hex bin plot comparing Time on App and Length of Membership.
In [283]:
Out[283]:
Let's explore these types of relationships across the entire data set. Use pairplot to recreate the plot below.(Don't worry about the the colors)
In [284]:
Out[284]:
Based off this plot what looks to be the most correlated feature with Yearly Amount Spent?
In [285]:
Create a linear model plot (using seaborn's lmplot) of Yearly Amount Spent vs. Length of Membership.
In [286]:
Out[286]:
In [287]:
In [288]:
Use model_selection.train_test_split from sklearn to split the data into training and testing sets. Set test_size=0.3 and random_state=101
In [289]:
In [290]:
In [291]:
Create an instance of a LinearRegression() model named lm.
In [292]:
Train/fit lm on the training data.
In [293]:
Out[293]:
Print out the coefficients of the model
In [294]:
In [295]:
Create a scatterplot of the real test values versus the predicted values.
In [296]:
Out[296]:
In [303]:
In [317]:
We still want to figure out the answer to the original question, do we focus our efforst on mobile app or website development? Or maybe that doesn't even really matter, and Membership Time is what is really important. Let's see if we can interpret the coefficients at all to get an idea.
Recreate the dataframe below.
In [298]:
Out[298]:
How can you interpret these coefficients?
Answer here
Do you think the company should focus more on their mobile app or on their website?
Answer here