<jupyter_start><jupyter_text>Google Analytics Revenue PredictionThe 80/20 rule has proven true for many businesses–only a small percentage of customers produce most of the revenue. As such, marketing teams are challenged to make appropriate investments in promotional strategie* fullVisitorId- A unique identifier for each user of the Google Merchandise Store.* channelGrouping - The channel via which the user came to the Store.* date - The date on which the user visited the Store.* device - The specifications for the device used to access the Store.* geoNetwork - This section contains information about the geography of the user.* sessionId - A unique identifier for this visit to the store.* socialEngagementType - Engagement type, either "Socially Engaged" or "Not Socially Engaged".* totals - This section contains aggregate values across the session.* trafficSource - This section contains information about the Traffic Source from which the session originated.* visitId - An identifier for this session. This is part of the value usually stored as the _utmb cookie. This is only unique to the user. For a completely unique ID, you should use a combination of fullVisitorId and visitId.* visitNumber - The session number for this user. If this is the first session, then this is set to 1.* visitStartTime - The timestamp (expressed as POSIX time).<jupyter_code>import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import scipy
import ast
trainset = pd.read_csv('/Users/deven/Documents/largecsvs/Google Analytics/train.csv')
testset = pd.read_csv('/Users/deven/Documents/largecsvs/Google Analytics/test.csv')
trainset.describe()
trainset.head()
trainset.device[0]
trainset.geoNetwork[0]
trainset.totals[0]
trainset.socialEngagementType.unique()
trainset.trafficSource[0]
ast.literal_eval(trainset.totals[0])
trainset.fullVisitorId = [str(i) for i in trainset.fullVisitorId]
for index,i in enumerate(trainset.totals):
    diction = ast.literal_eval(i)
    if 'transactionRevenue' in diction.keys():
        trainset.Revenue[index]=int(diction['transactionRevenue'])
    else:
        trainset.Revenue[index]=0
    
trainset.Revenue<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07136322049405307, 'fraction_numerical': 0.005032021957913998, 'mean_word_length': 5.075, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '436762', 'license': 'Apache-2.0', 'n_tokens_mistral': 598, 'n_tokens_neox': 572, 'n_words': 247, 'path': 'Google Analytics Customer Revenue Prediction/.ipynb_checkpoints/Google_Analytics_Main-checkpoint.ipynb', 'repo_name': 'djmor12/Metis', 'size': '2186'}