/ Python And R Data science skills: 66 ECommerse csv Qustions Part 02

Friday 16 February 2018

66 ECommerse csv Qustions Part 02

https://vlrtraining.com/courses/python-data-science-beginner-tutorial 66 ECommerse csv Qustions Part 02
In [1]:
#ecom = pd.read_csv('Ecommerce.csv')
import pandas as pd
ecom=pd.read_csv("Ecommerce.csv")

How many people made the purchase during the AM and how many people made the purchase during PM ?

ecom['AM or PM'].value_counts()

In [23]:
#ecom.head(3)
#ecom["AM or PM"].value_counts()
#ecom.head(3)
ecom["Browser Info"].value_counts()
Out[23]:
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.2; Trident/3.1)                                                                        12
Mozilla/5.0 (compatible; MSIE 5.0; Windows NT 6.0; Trident/3.0)                                                                        12
Mozilla/5.0 (compatible; MSIE 9.0; Windows 95; Trident/4.1)                                                                            12
Mozilla/5.0 (compatible; MSIE 9.0; Windows CE; Trident/4.1)                                                                            12
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 5.01; Trident/5.0)                                                                       11
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.0; Trident/4.0)                                                                        11
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 5.2; Trident/5.0)                                                                        11
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0)                                                                        11
Mozilla/5.0 (compatible; MSIE 8.0; Windows CE; Trident/5.0)                                                                            11
Mozilla/5.0 (compatible; MSIE 5.0; Windows NT 6.2; Trident/5.0)                                                                        11
Mozilla/5.0 (compatible; MSIE 5.0; Windows NT 6.1; Trident/3.0)                                                                        10
Mozilla/5.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0)                                                                        10
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.01; Trident/4.1)                                                                       10
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 4.0; Trident/5.0)                                                                        10
Mozilla/5.0 (compatible; MSIE 7.0; Windows 95; Trident/3.1)                                                                            10
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.2; Trident/3.1)                                                                        10
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0)                                                                        10
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.1)                                                                        10
Mozilla/5.0 (compatible; MSIE 9.0; Windows CE; Trident/3.1)                                                                            10
Mozilla/5.0 (compatible; MSIE 8.0; Windows 95; Trident/3.1)                                                                            10
Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 6.1; Trident/3.1)                                                                         9
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; Trident/5.0)                                                                         9
Mozilla/5.0 (compatible; MSIE 6.0; Windows 95; Trident/4.1)                                                                             9
Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.2; Trident/3.1)                                                                         9
Mozilla/5.0 (compatible; MSIE 7.0; Windows CE; Trident/5.0)                                                                             9
Mozilla/5.0 (compatible; MSIE 6.0; Windows CE; Trident/3.1)                                                                             9
Mozilla/5.0 (compatible; MSIE 7.0; Windows 98; Trident/5.0)                                                                             9
Mozilla/5.0 (compatible; MSIE 9.0; Windows 95; Trident/3.0)                                                                             9
Mozilla/5.0 (compatible; MSIE 6.0; Windows NT 5.01; Trident/3.1)                                                                        9
Mozilla/5.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/3.0)                                                                         9
                                                                                                                                       ..
Mozilla/5.0 (X11; Linux x86_64; rv:1.9.7.20) Gecko/2012-12-18 19:55:53 Firefox/9.0                                                      1
Mozilla/5.0 (X11; Linux i686; rv:1.9.6.20) Gecko/2012-10-04 04:18:08 Firefox/3.6.14                                                     1
Mozilla/5.0 (Windows; U; Windows 98; Win 9x 4.90) AppleWebKit/531.44.1 (KHTML, like Gecko) Version/4.0.3 Safari/531.44.1                1
Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_3 rv:2.0; en-US) AppleWebKit/531.31.4 (KHTML, like Gecko) Version/5.0.5 Safari/531.31.4       1
Mozilla/5.0 (Windows; U; Windows CE) AppleWebKit/535.10.4 (KHTML, like Gecko) Version/5.0.3 Safari/535.10.4                             1
Opera/8.76.(Windows NT 5.01; it-IT) Presto/2.9.167 Version/10.00                                                                        1
Mozilla/5.0 (X11; Linux i686) AppleWebKit/5320 (KHTML, like Gecko) Chrome/13.0.839.0 Safari/5320                                        1
Opera/9.75.(X11; Linux x86_64; sl-SI) Presto/2.9.183 Version/11.00                                                                      1
Opera/9.55.(Windows NT 5.0; en-US) Presto/2.9.186 Version/12.00                                                                         1
Opera/8.16.(Windows NT 6.2; en-US) Presto/2.9.176 Version/11.00                                                                         1
Opera/9.21.(Windows NT 6.1; it-IT) Presto/2.9.177 Version/10.00                                                                         1
Mozilla/5.0 (Windows NT 6.1; sl-SI; rv:1.9.0.20) Gecko/2010-01-09 22:20:00 Firefox/3.6.1                                                1
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_5) AppleWebKit/5320 (KHTML, like Gecko) Chrome/14.0.838.0 Safari/5320                      1
Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/5311 (KHTML, like Gecko) Chrome/15.0.860.0 Safari/5311                                      1
Mozilla/5.0 (Windows CE; it-IT; rv:1.9.1.20) Gecko/2010-06-29 20:17:08 Firefox/3.6.2                                                    1
Mozilla/5.0 (Windows; U; Windows CE) AppleWebKit/535.27.5 (KHTML, like Gecko) Version/5.0.2 Safari/535.27.5                             1
Mozilla/5.0 (X11; Linux i686; rv:1.9.5.20) Gecko/2016-01-21 02:45:48 Firefox/3.8                                                        1
Mozilla/5.0 (Windows NT 6.1; sl-SI; rv:1.9.2.20) Gecko/2013-03-04 05:45:35 Firefox/14.0                                                 1
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_5_3; rv:1.9.4.20) Gecko/2012-02-20 19:04:15 Firefox/3.8                                    1
Mozilla/5.0 (X11; Linux x86_64; rv:1.9.6.20) Gecko/2014-01-05 14:12:15 Firefox/10.0                                                     1
Opera/8.98.(Windows NT 5.0; en-US) Presto/2.9.176 Version/11.00                                                                         1
Opera/8.36.(Windows NT 5.0; sl-SI) Presto/2.9.171 Version/11.00                                                                         1
Mozilla/5.0 (X11; Linux i686) AppleWebKit/5322 (KHTML, like Gecko) Chrome/14.0.863.0 Safari/5322                                        1
Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_8 rv:6.0; sl-SI) AppleWebKit/532.49.7 (KHTML, like Gecko) Version/5.0.1 Safari/532.49.7       1
Opera/8.19.(Windows NT 6.0; it-IT) Presto/2.9.172 Version/11.00                                                                         1
Opera/9.90.(Windows NT 4.0; en-US) Presto/2.9.160 Version/12.00                                                                         1
Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_0 rv:4.0; it-IT) AppleWebKit/532.22.6 (KHTML, like Gecko) Version/4.0.2 Safari/532.22.6     1
Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7_3; rv:1.9.2.20) Gecko/2011-05-31 21:23:54 Firefox/3.6.15                                 1
Mozilla/5.0 (Windows 95; it-IT; rv:1.9.1.20) Gecko/2015-05-05 18:02:26 Firefox/6.0                                                      1
Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_9) AppleWebKit/5351 (KHTML, like Gecko) Chrome/15.0.892.0 Safari/5351                      1
Name: Browser Info, Length: 8287, dtype: int64

What are the 5 most common Job Titles?

ecom['Job'].value_counts().head(5)

In [9]:
#ecom.head(3)
ecom["Job"].value_counts().head(5)
Out[9]:
Interior and spatial designer    31
Lawyer                           30
Social researcher                28
Purchasing manager               27
Designer, jewellery              27
Name: Job, dtype: int64

Someone made a purchase that came from Lot: "90 WT" , what was the Purchase Price for this transaction?

ecom[ecom['Lot']=='90 WT']['Purchase Price']

In [13]:
ecom[ecom['Lot']=="90 WT"]["Purchase Price"]
Out[13]:
513    75.1
Name: Purchase Price, dtype: float64

What is the email of the person with the following Credit Card Number: 4926535242672853

"Credit Card"] == 4926535242672853]['Email']

In [17]:
ecom[ecom['Credit Card']==4926535242672853]['Email']
Out[17]:
1234    bondellen@williams-garza.com
Name: Email, dtype: object

How many people have American Express as their Credit Card Provider and made a purchase above $95 ?

ecom[(ecom['CC Provider']=='American Express') & (ecom['Purchase Price']>95)].count()

In [21]:
#sum((ecom['CC Provider']=='American Express')&(ecom['Purchase Price']>95))
ecom[(ecom['CC Provider']=='American Express')&(ecom['Purchase Price']>95)].count()
Out[21]:
Address             39
Lot                 39
AM or PM            39
Browser Info        39
Company             39
Credit Card         39
CC Exp Date         39
CC Security Code    39
CC Provider         39
Email               39
Job                 39
IP Address          39
Language            39
Purchase Price      39
dtype: int64

How many people have American Express as their Credit Card Provider and made a purchase above $95 ?

ecom[(ecom['CC Provider']=='American Express') & (ecom['Purchase Price']>95)].count()

No comments:

Post a Comment