<jupyter_start><jupyter_text><jupyter_code># Imports
import pandas as pd
# Url
black_friday_csv_link = "https://raw.githubusercontent.com/pierretd/datasets-1/master/BlackFriday.csv"
# Reading in csv
black_friday_df = pd.read_csv(black_friday_csv_link)<jupyter_output><empty_output><jupyter_text>The above dataset has already been loaded in for you, answer the following questions. If you get done quickly, move onto stretch goals and super stretch goals. Work on improving your model until 8:40.  1) Clean the data set and drop the Null/NaN values. Rename  Product_Category_1-3 columns with an actual Product.<jupyter_code>black_friday_df = black_friday_df.dropna()
black_friday_df.dropna(axis='columns')
'df.rename(index=str, columns= ('product_category_1', 'product_category_2', 'product_category_3)

import numpy as np
print(black_friday_df.columns)
black_friday_df.columns = ['User_ID', 'Product_ID', 'Gender', 'Age', 'Occupation', 'City_Category',
       'Stay_In_Current_City_Years', 'Marital_Status', 'Foods',
       'Appliance', 'Technology', 'Purchase']
Index(['User_ID', 'Product_ID', 'Gender', 'Age', 'Occupation', 'City_Category',
       'Stay_In_Current_City_Years', 'Marital_Status', 'Product_Category_1',
       'Product_Category_2', 'Product_Category_3', 'Purchase'],
      dtype='object')
black_friday_df.isnull().sum()<jupyter_output><empty_output><jupyter_text>2) How many unique user_ids does the data set contain?<jupyter_code>variablehi = black_friday_df['User_ID'].nunique()
print(variablehi)
black_friday_df.head(5)<jupyter_output><empty_output><jupyter_text>3) How many unique age brackets are in the dataset. Which Age bracket has the most entries? Which has the least?<jupyter_code>black_friday_df.Age.nunique()
black_friday_df.Age.value_counts()
#26-35
#0-17<jupyter_output><empty_output><jupyter_text>4) Transform the Gender categorical variable into a numerical variable. Then transform that numerical value into a Boolean.<jupyter_code>black_friday_df['Gender'].replace(0, 'F',inplace=True)
black_friday_df['Gender'].replace(1, 'M',inplace=True)
black_friday_df['Gender'] = black_friday_df['Gender'].replace('0',True,inplace=True)
black_friday_df['Gender'] = black_friday_df['Gender'].replace('1',False,inplace=True)
black_friday_df.head(5)<jupyter_output><empty_output><jupyter_text>5) What is the average Occupation score? What is the Standard Deviation? What is the maximum and minimum value?<jupyter_code>print('Average Occupation Score:')
black_friday_df.Occupation.mean()
print('Standard Deviation:')
black_friday_df.Occupation.std()
print('Maximum Value:')
black_friday_df['Occupation'].max()
print('Minimum Value:')
black_friday_df['Occupation'].min()<jupyter_output>Maximum Value:
Minimum Value:<jupyter_text>6) Group Age by Gender and print out a cross tab with age as the y axis<jupyter_code>blackfriday2 = black_friday_df.groupby(black_friday_df['Age'])
pd.crosstab([index = blackfriday2]rownames= blackfridaycross<jupyter_output><empty_output><jupyter_text>Stretch Goal:  Build a linear regression model to predict the purchase amount given the other features in the data set with scikit learn.<jupyter_code><jupyter_output><empty_output><jupyter_text>Super Stretch Goals:   Plot the actual values vs the predicted values.<jupyter_code><jupyter_output><empty_output><jupyter_text>Find a good way to measure your model's predictive power.<jupyter_code><jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11445255474452555, 'fraction_numerical': 0.009635036496350365, 'mean_word_length': 8.516666666666667, 'pattern_counts': {'":': 0, '<': 40, '<?xml version=': 0, '>': 40, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '10', 'dir': 'jupyter-structured-clean-dedup', 'id': '334390', 'license': 'MIT', 'n_tokens_mistral': 1202, 'n_tokens_neox': 1154, 'n_words': 257, 'path': 'Copy_of_Black_Friday.ipynb', 'repo_name': 'HeyLaxmi/DS-Unit-1-Sprint-1-Dealing-With-Data', 'size': '3425'}