https://www.kaggle.com/datasets/utkarsharya/ecommerce-purchases?resource=download

In [1]:
import pandas as pd
In [5]:
data = pd.read_csv('Ecommerce Purchases')

1. Display Top 10 Rows of the DataSet¶

In [6]:
data.head(10)
Out[6]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
0 16629 Pace Camp Apt. 448\nAlexisborough, NE 77... 46 in PM Opera/9.56.(X11; Linux x86_64; sl-SI) Presto/2... Martinez-Herman 6011929061123406 02/20 900 JCB 16 digit pdunlap@yahoo.com Scientist, product/process development 149.146.147.205 el 98.14
1 9374 Jasmine Spurs Suite 508\nSouth John, TN 8... 28 rn PM Opera/8.93.(Windows 98; Win 9x 4.90; en-US) Pr... Fletcher, Richards and Whitaker 3337758169645356 11/18 561 Mastercard anthony41@reed.com Drilling engineer 15.160.41.51 fr 70.73
2 Unit 0065 Box 5052\nDPO AP 27450 94 vE PM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Simpson, Williams and Pham 675957666125 08/19 699 JCB 16 digit amymiller@morales-harrison.com Customer service manager 132.207.160.22 de 0.95
3 7780 Julia Fords\nNew Stacy, WA 45798 36 vm PM Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_0 ... Williams, Marshall and Buchanan 6011578504430710 02/24 384 Discover brent16@olson-robinson.info Drilling engineer 30.250.74.19 es 78.04
4 23012 Munoz Drive Suite 337\nNew Cynthia, TX 5... 20 IE AM Opera/9.58.(X11; Linux x86_64; it-IT) Presto/2... Brown, Watson and Andrews 6011456623207998 10/25 678 Diners Club / Carte Blanche christopherwright@gmail.com Fine artist 24.140.33.94 es 77.82
5 7502 Powell Mission Apt. 768\nTravisland, VA 3... 21 XT PM Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_5... Silva-Anderson 30246185196287 07/25 7169 Discover ynguyen@gmail.com Fish farm manager 55.96.152.147 ru 25.15
6 93971 Conway Causeway\nAndersonburgh, AZ 75107 96 Xt AM Mozilla/5.0 (compatible; MSIE 7.0; Windows NT ... Gibson and Sons 6011398782655569 07/24 714 VISA 16 digit olivia04@yahoo.com Dancer 127.252.144.18 de 88.56
7 260 Rachel Plains Suite 366\nCastroberg, WV 24... 96 pG PM Mozilla/5.0 (X11; Linux i686) AppleWebKit/5350... Marshall-Collins 561252141909 06/25 256 VISA 13 digit phillip48@parks.info Event organiser 224.247.97.150 pt 44.25
8 2129 Dylan Burg\nNew Michelle, ME 28650 45 JN PM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7... Galloway and Sons 180041795790001 04/24 899 JCB 16 digit kdavis@rasmussen.com Financial manager 146.234.201.229 ru 59.54
9 3795 Dawson Extensions\nLake Tinafort, ID 88739 15 Ug AM Mozilla/5.0 (X11; Linux i686; rv:1.9.7.20) Gec... Rivera, Buchanan and Ramirez 4396283918371 01/17 931 American Express qcoleman@hunt-huerta.com Forensic scientist 236.198.199.8 zh 95.63

2. Check Last 10 Rows of the DataSet¶

In [7]:
data.tail(10)
Out[7]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
9990 75731 Molly Springs\nWest Danielle, VT 96934-5102 93 ty PM Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_4;... Pace, Vazquez and Richards 869968197049750 04/24 877 JCB 15 digit andersonmichael@sherman.biz Early years teacher 54.170.3.185 ru 18.35
9991 PSC 8165, Box 8498\nAPO AP 60327-0346 50 dA AM Mozilla/5.0 (compatible; MSIE 8.0; Windows NT ... Snyder Inc 4221582137197481 02/24 969 Voyager kking@wise-liu.com IT sales professional 254.25.31.156 el 25.93
9992 885 Allen Mountains Apt. 230\nWallhaven, LA 16995 40 vH PM Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) A... Wells Ltd 4664825258997302 10/20 431 Discover bberry@wright.net Set designer 174.173.51.32 de 67.96
9993 7555 Larson Locks Suite 229\nEllisburgh, MA 34... 72 jg PM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_8... Colon and Sons 30025560104631 10/25 629 Maestro chelseawilliams@lopez.biz Designer, exhibition/display 177.46.82.128 el 65.61
9994 6276 Rojas Hollow\nLake Louis, WY 56410-7837 93 Ex PM Opera/9.68.(X11; Linux x86_64; sl-SI) Presto/2... Ritter-Smith 3112186784121077 01/25 1823 Maestro iroberts@gmail.com Education officer, museum 242.44.112.18 zh 31.85
9995 966 Castaneda Locks\nWest Juliafurt, CO 96415 92 XI PM Mozilla/5.0 (Windows NT 5.1) AppleWebKit/5352 ... Randall-Sloan 342945015358701 03/22 838 JCB 15 digit iscott@wade-garner.com Printmaker 29.73.197.114 it 82.21
9996 832 Curtis Dam Suite 785\nNorth Edwardburgh, T... 41 JY AM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Hale, Collins and Wilson 210033169205009 07/25 207 JCB 16 digit mary85@hotmail.com Energy engineer 121.133.168.51 pt 25.63
9997 Unit 4434 Box 6343\nDPO AE 28026-0283 74 Zh AM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7... Anderson Ltd 6011539787356311 05/21 1 VISA 16 digit tyler16@gmail.com Veterinary surgeon 156.210.0.254 el 83.98
9998 0096 English Rest\nRoystad, IA 12457 74 cL PM Mozilla/5.0 (Macintosh; Intel Mac OS X 10_8_8;... Cook Inc 180003348082930 11/17 987 American Express elizabethmoore@reid.net Local government officer 55.78.26.143 es 38.84
9999 40674 Barrett Stravenue\nGrimesville, WI 79682 64 Hr AM Mozilla/5.0 (X11; Linux i686; rv:1.9.5.20) Gec... Greene Inc 4139972901927273 02/19 302 JCB 15 digit rachelford@vaughn.com Embryologist, clinical 176.119.198.199 el 67.59

3. Check Datatype of Each Column¶

In [9]:
data.dtypes
Out[9]:
Address              object
Lot                  object
AM or PM             object
Browser Info         object
Company              object
Credit Card           int64
CC Exp Date          object
CC Security Code      int64
CC Provider          object
Email                object
Job                  object
IP Address           object
Language             object
Purchase Price      float64
dtype: object

4. Check Null Values in the DataSet¶

In [11]:
data.isnull().sum()
Out[11]:
Address             0
Lot                 0
AM or PM            0
Browser Info        0
Company             0
Credit Card         0
CC Exp Date         0
CC Security Code    0
CC Provider         0
Email               0
Job                 0
IP Address          0
Language            0
Purchase Price      0
dtype: int64

5. How Many Rows and Columns are there in Our DataSet?¶

In [8]:
data.shape
Out[8]:
(10000, 14)
In [13]:
data.shape[1]
Out[13]:
14
In [14]:
len(data.columns)
Out[14]:
14
In [15]:
data.shape[0]
Out[15]:
10000
In [16]:
len(data)
Out[16]:
10000
In [17]:
data.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 10000 entries, 0 to 9999
Data columns (total 14 columns):
 #   Column            Non-Null Count  Dtype  
---  ------            --------------  -----  
 0   Address           10000 non-null  object 
 1   Lot               10000 non-null  object 
 2   AM or PM          10000 non-null  object 
 3   Browser Info      10000 non-null  object 
 4   Company           10000 non-null  object 
 5   Credit Card       10000 non-null  int64  
 6   CC Exp Date       10000 non-null  object 
 7   CC Security Code  10000 non-null  int64  
 8   CC Provider       10000 non-null  object 
 9   Email             10000 non-null  object 
 10  Job               10000 non-null  object 
 11  IP Address        10000 non-null  object 
 12  Language          10000 non-null  object 
 13  Purchase Price    10000 non-null  float64
dtypes: float64(1), int64(2), object(11)
memory usage: 1.1+ MB

6. Highest and Lowest Purchase Prices¶

In [28]:
data.max()
Out[28]:
Address                              Unit 9991 Box 3616\nDPO AA 99399
Lot                                                             99 zl
AM or PM                                                           PM
Browser Info        Opera/9.99.(X11; Linux x86_64; it-IT) Presto/2...
Company                                                 Zuniga-Watson
Credit Card                                          6011999761615928
CC Exp Date                                                     12/25
CC Security Code                                                 9993
CC Provider                                                   Voyager
Email                                                zyoung@yahoo.com
Job                                                      Youth worker
IP Address                                               99.96.230.38
Language                                                           zh
Purchase Price                                                  99.99
dtype: object
In [27]:
# Highest Purchase Prices
data['Purchase Price'].max()
Out[27]:
99.99
In [21]:
print(data.min())
Address             000 Jared Shoals Apt. 244\nRamirezmouth, IL 12450
Lot                                                             00 AG
AM or PM                                                           AM
Browser Info        Mozilla/5.0 (Macintosh; Intel Mac OS X 10_5_0 ...
Company                                                    Abbott Ltd
Credit Card                                               60401860543
CC Exp Date                                                     01/17
CC Security Code                                                    0
CC Provider                                          American Express
Email                                             aabbott@hotmail.com
Job                                                Academic librarian
IP Address                                               0.116.212.13
Language                                                           de
Purchase Price                                                    0.0
dtype: object
In [29]:
# Lowest Purchase Prices
data['Purchase Price'].min()
Out[29]:
0.0

7. Average Purchase Price¶

In [31]:
data['Purchase Price'].mean()
Out[31]:
50.34730200000025

8. How many People have French 'fr' as their Language?¶

In [36]:
data.Language == 'fr'
Out[36]:
0       False
1        True
2       False
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Name: Language, Length: 10000, dtype: bool
In [45]:
data[data.Language == 'fr']
Out[45]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
1 9374 Jasmine Spurs Suite 508\nSouth John, TN 8... 28 rn PM Opera/8.93.(Windows 98; Win 9x 4.90; en-US) Pr... Fletcher, Richards and Whitaker 3337758169645356 11/18 561 Mastercard anthony41@reed.com Drilling engineer 15.160.41.51 fr 70.73
19 125 Hall Summit\nBoothton, IL 41721 99 CU PM Mozilla/5.0 (compatible; MSIE 7.0; Windows NT ... Turner-Mckinney 676343504830 02/20 440 VISA 16 digit ruiznicole@gmail.com Designer, interior/spatial 25.105.209.214 fr 58.39
53 PSC 9431, Box 7059\nAPO AA 29285-1363 14 qD AM Opera/9.34.(X11; Linux x86_64; it-IT) Presto/2... Higgins, Cardenas and Kennedy 869972604798355 08/17 157 JCB 16 digit amorales@yahoo.com Technical author 44.108.117.122 fr 10.41
76 49206 Campbell Port\nNorth Cliffordshire, HI 3... 71 iu PM Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_5_9... Jacobs-Tucker 6011343518820988 01/17 806 Voyager eperez@hotmail.com Paramedic 210.207.58.168 fr 57.34
82 493 Smith Valleys Suite 004\nNew Madelineville... 35 ls PM Mozilla/5.0 (iPod; U; CPU iPhone OS 4_0 like M... Robinson, Johnston and Valdez 4351359627548412 06/17 937 VISA 13 digit amendez@yahoo.com Engineer, materials 163.129.163.100 fr 49.04
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9941 43757 Brown Lodge\nValerieberg, PR 88518 68 DG AM Mozilla/5.0 (compatible; MSIE 5.0; Windows NT ... Jones, Williams and Dunn 6011508474487291 04/26 906 Mastercard christian55@gmail.com Secondary school teacher 216.118.235.145 fr 60.03
9947 32827 Carl Inlet\nSouth Nicole, NY 38081-6636 40 Dp PM Mozilla/5.0 (Windows; U; Windows 95) AppleWebK... Pruitt-Flores 3158564208754951 03/17 386 Mastercard josephsmith@gmail.com Textile designer 198.68.38.23 fr 49.61
9951 518 Brown Dam\nGarciaside, IN 33057 71 wq AM Mozilla/5.0 (compatible; MSIE 8.0; Windows NT ... Crosby, Vasquez and Ballard 5256758441931287 12/17 146 VISA 16 digit cjennings@yahoo.com Lighting technician, broadcasting/film/video 58.12.83.1 fr 57.59
9977 02182 Keith Expressway\nEast Shannon, CT 20578... 34 RL AM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Deleon, Jacobson and Benton 4186094003664688 06/21 397 JCB 16 digit daltoncarter@yahoo.com Biomedical engineer 146.238.118.2 fr 94.93
9980 6061 Dave Lights\nPhillipsview, UT 40500 25 Mv AM Opera/8.58.(Windows NT 5.0; it-IT) Presto/2.9.... Cortez-Frye 6011944199756993 12/24 755 JCB 15 digit mark74@kirby-stewart.org Textile designer 110.103.77.195 fr 16.05

1097 rows × 14 columns

In [46]:
data[data.Language == 'fr'].shape[0]
Out[46]:
1097
In [47]:
len(data[data.Language == 'fr'])
Out[47]:
1097
In [48]:
data[data.Language == 'fr'].count()
Out[48]:
Address             1097
Lot                 1097
AM or PM            1097
Browser Info        1097
Company             1097
Credit Card         1097
CC Exp Date         1097
CC Security Code    1097
CC Provider         1097
Email               1097
Job                 1097
IP Address          1097
Language            1097
Purchase Price      1097
dtype: int64

9. Job Title Contains Engineer¶

In [58]:
data['Job']
Out[58]:
0       Scientist, product/process development
1                            Drilling engineer
2                     Customer service manager
3                            Drilling engineer
4                                  Fine artist
                         ...                  
9995                                Printmaker
9996                           Energy engineer
9997                        Veterinary surgeon
9998                  Local government officer
9999                    Embryologist, clinical
Name: Job, Length: 10000, dtype: object
In [59]:
data['Job'].str.contains('engineer')
Out[59]:
0       False
1        True
2       False
3        True
4       False
        ...  
9995    False
9996     True
9997    False
9998    False
9999    False
Name: Job, Length: 10000, dtype: bool
In [65]:
# data[data['Job'].str.contains('engineer')]
In [66]:
len(data[data['Job'].str.contains('engineer',case=False)])
Out[66]:
984

10. Find Email of the Person with the following IP address: 132.207.160.22¶

In [68]:
data['IP Address']== '132.207.160.22'
Out[68]:
0       False
1       False
2        True
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Name: IP Address, Length: 10000, dtype: bool
In [71]:
data[data['IP Address']== '132.207.160.22']
Out[71]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
2 Unit 0065 Box 5052\nDPO AP 27450 94 vE PM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Simpson, Williams and Pham 675957666125 08/19 699 JCB 16 digit amymiller@morales-harrison.com Customer service manager 132.207.160.22 de 0.95
In [70]:
data[data['IP Address']== '132.207.160.22']['Email']
Out[70]:
2    amymiller@morales-harrison.com
Name: Email, dtype: object

11. How many People have Mastercard 💳 as their Credit Card provider and made a purchase above 50?¶

In [78]:
data['CC Provider']
Out[78]:
0                      JCB 16 digit
1                        Mastercard
2                      JCB 16 digit
3                          Discover
4       Diners Club / Carte Blanche
                   ...             
9995                   JCB 15 digit
9996                   JCB 16 digit
9997                  VISA 16 digit
9998               American Express
9999                   JCB 15 digit
Name: CC Provider, Length: 10000, dtype: object
In [79]:
data['CC Provider']=='Mastercard'
Out[79]:
0       False
1        True
2       False
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Name: CC Provider, Length: 10000, dtype: bool
In [80]:
(data['CC Provider']=='Mastercard') & (data['Purchase Price'] > 50)
Out[80]:
0       False
1        True
2       False
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Length: 10000, dtype: bool
In [81]:
data[(data['CC Provider']=='Mastercard') & (data['Purchase Price'] > 50)]
Out[81]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
1 9374 Jasmine Spurs Suite 508\nSouth John, TN 8... 28 rn PM Opera/8.93.(Windows 98; Win 9x 4.90; en-US) Pr... Fletcher, Richards and Whitaker 3337758169645356 11/18 561 Mastercard anthony41@reed.com Drilling engineer 15.160.41.51 fr 70.73
18 461 Christopher Square\nWest Michaelchester, C... 17 SB PM Mozilla/5.0 (X11; Linux i686; rv:1.9.6.20) Gec... Beard, Abbott and Pena 6011350184276270 12/22 767 Mastercard hannah63@yahoo.com Photographer 73.250.176.201 el 70.15
31 USNS Alvarado\nFPO AA 27052-1231 26 Lh PM Opera/8.84.(X11; Linux i686; sl-SI) Presto/2.9... Nicholson Group 4614997834548 03/22 909 Mastercard ashley12@hotmail.com Sales executive 94.176.142.201 en 94.14
35 93392 Webb Gardens Apt. 220\nLaurabury, AR 999... 37 om AM Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_7... Mora Ltd 6011049630969815 09/16 367 Mastercard hgonzalez@mcdowell.com Lecturer, further education 216.23.95.40 zh 97.46
90 431 Bowen Lights\nFergusonborough, MH 01362 31 tG AM Mozilla/5.0 (Windows NT 5.2; it-IT; rv:1.9.1.2... Copeland-Lee 639032576097 06/18 868 Mastercard nrogers@brown.com Teacher, English as a foreign language 153.188.13.203 es 78.86
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9941 43757 Brown Lodge\nValerieberg, PR 88518 68 DG AM Mozilla/5.0 (compatible; MSIE 5.0; Windows NT ... Jones, Williams and Dunn 6011508474487291 04/26 906 Mastercard christian55@gmail.com Secondary school teacher 216.118.235.145 fr 60.03
9948 95544 Johnson Isle Suite 939\nMichaelberg, RI ... 91 bW AM Opera/8.36.(X11; Linux x86_64; sl-SI) Presto/2... Fox-Peterson 4762924304307 03/17 567 Mastercard haleybenjamin@gmail.com Structural engineer 120.36.140.58 en 71.89
9954 051 Samantha Wells Apt. 328\nScottborough, OR ... 11 vG AM Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_2... Mendoza, Zimmerman and Reilly 30232295374907 05/21 762 Mastercard brownamy@perkins.com Presenter, broadcasting 61.97.84.101 it 87.15
9981 087 Larson Roads Apt. 587\nRicestad, WI 98077-... 95 Kw AM Opera/9.63.(Windows NT 5.01; en-US) Presto/2.9... Ortiz, Schultz and Adams 4690863684605 01/19 695 Mastercard laurenbennett@richards.com Environmental education officer 106.21.237.73 pt 63.61
9987 2754 Klein Mission\nJohnsonview, PA 64925-9624 65 Fg PM Opera/9.26.(Windows CE; sl-SI) Presto/2.9.188 ... Curtis LLC 180027305702263 12/24 865 Mastercard denisehamilton@novak.biz Primary school teacher 164.39.190.217 es 60.83

405 rows × 14 columns

In [82]:
len(data[(data['CC Provider']=='Mastercard') & (data['Purchase Price'] > 50)])
Out[82]:
405
In [84]:
data[(data['CC Provider']=='Mastercard') \
     & (data['Purchase Price'] > 50)].count()
Out[84]:
Address             405
Lot                 405
AM or PM            405
Browser Info        405
Company             405
Credit Card         405
CC Exp Date         405
CC Security Code    405
CC Provider         405
Email               405
Job                 405
IP Address          405
Language            405
Purchase Price      405
dtype: int64

12. Find Email of the Person with the following CreditCard Nr.: 4664825258997302¶

In [92]:
data['Credit Card'] == 4664825258997302
Out[92]:
0       False
1       False
2       False
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Name: Credit Card, Length: 10000, dtype: bool
In [96]:
data[data['Credit Card'] == 4664825258997302]
Out[96]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
9992 885 Allen Mountains Apt. 230\nWallhaven, LA 16995 40 vH PM Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) A... Wells Ltd 4664825258997302 10/20 431 Discover bberry@wright.net Set designer 174.173.51.32 de 67.96
In [97]:
data[data['Credit Card'] == 4664825258997302]['Email']
Out[97]:
9992    bberry@wright.net
Name: Email, dtype: object

13. How Many People Purchase during the AM and How many People Purchase during PM?¶

In [108]:
data['AM or PM'].value_counts()
Out[108]:
PM    5068
AM    4932
Name: AM or PM, dtype: int64

14. How Many People have a CreditCard that expires in 2020?¶

In [125]:
data['CC Exp Date']
Out[125]:
0       02/20
1       11/18
2       08/19
3       02/24
4       10/25
        ...  
9995    03/22
9996    07/25
9997    05/21
9998    11/17
9999    02/19
Name: CC Exp Date, Length: 10000, dtype: object
In [128]:
def fun():
    count=0
    for date in data['CC Exp Date']:
        if date.split('/')[1]=='20':
            count=count+1
    print(count)
In [129]:
fun()
988
In [130]:
data['CC Exp Date'].apply(lambda x:x[3:]=='20')
Out[130]:
0        True
1       False
2       False
3       False
4       False
        ...  
9995    False
9996    False
9997    False
9998    False
9999    False
Name: CC Exp Date, Length: 10000, dtype: bool
In [131]:
data[data['CC Exp Date'].apply(lambda x:x[3:]=='20')]
Out[131]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price
0 16629 Pace Camp Apt. 448\nAlexisborough, NE 77... 46 in PM Opera/9.56.(X11; Linux x86_64; sl-SI) Presto/2... Martinez-Herman 6011929061123406 02/20 900 JCB 16 digit pdunlap@yahoo.com Scientist, product/process development 149.146.147.205 el 98.14
19 125 Hall Summit\nBoothton, IL 41721 99 CU PM Mozilla/5.0 (compatible; MSIE 7.0; Windows NT ... Turner-Mckinney 676343504830 02/20 440 VISA 16 digit ruiznicole@gmail.com Designer, interior/spatial 25.105.209.214 fr 58.39
32 Unit 3628 Box 6778\nDPO AE 72362 39 Qm PM Mozilla/5.0 (Windows 98; Win 9x 4.90) AppleWeb... Martinez-Wilson 4942281854569455 01/20 8360 JCB 16 digit shane21@atkinson.com Civil Service fast streamer 196.37.134.217 pt 56.63
36 9374 Skinner Common Apt. 254\nChristopherfort,... 80 Fq PM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Hanna-Grant 180042289507877 09/20 912 VISA 16 digit saundersernest@walsh.com Animal technologist 85.134.58.250 zh 9.77
38 9671 Riley Drives Apt. 746\nPort Davidtown, TN... 15 vj AM Mozilla/5.0 (X11; Linux i686; rv:1.9.6.20) Gec... Bryant, Hubbard and Gonzales 210094965373094 12/20 248 Voyager djennings@boyd-english.org Music therapist 143.138.65.219 en 30.07
... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
9883 751 Petersen Groves\nLake Rebecca, NM 55875 61 tE PM Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10_8_7... Perez and Sons 4939814860063025 05/20 238 Mastercard lisa25@hotmail.com Therapeutic radiographer 215.85.159.70 pt 67.47
9901 908 Norman Burgs\nPhillipsberg, VT 92023-9956 90 Ng PM Mozilla/5.0 (compatible; MSIE 9.0; Windows NT ... Hughes Inc 30148833294789 09/20 483 Voyager james32@gmail.com Meteorologist 250.66.85.29 en 57.25
9911 44320 Gray Centers Suite 325\nJenniferfurt, OK... 19 Bf PM Mozilla/5.0 (X11; Linux i686; rv:1.9.7.20) Gec... Jones-Gray 4058074716188 12/20 921 Diners Club / Carte Blanche hensonlindsay@graves-fox.com Optician, dispensing 84.118.30.56 en 20.63
9957 73556 Chase Pine\nBrucemouth, MP 73473 25 rU PM Opera/9.49.(Windows 95; en-US) Presto/2.9.189 ... Martin, Clayton and Jarvis 3337737293232646 05/20 798 VISA 13 digit latashaochoa@gmail.com Therapeutic radiographer 239.219.241.162 ru 71.85
9992 885 Allen Mountains Apt. 230\nWallhaven, LA 16995 40 vH PM Mozilla/5.0 (Macintosh; PPC Mac OS X 10_6_5) A... Wells Ltd 4664825258997302 10/20 431 Discover bberry@wright.net Set designer 174.173.51.32 de 67.96

988 rows × 14 columns

In [132]:
len(data[data['CC Exp Date'].apply(lambda x:x[3:]=='20')])
Out[132]:
988

15. Top 5 Most Popular Email providers (e.g. gmail.com, yahoo.com, etc)¶

In [141]:
data['Email'].value_counts()
Out[141]:
asanchez@hotmail.com            2
znguyen@gmail.com               2
krodriguez@yahoo.com            2
djackson@hotmail.com            2
wedwards@yahoo.com              2
                               ..
matthew16@gmail.com             1
xlucero@welch-walsh.com         1
teresaramirez@gmail.com         1
stephanierichard@hotmail.com    1
lwoods@frank.com                1
Name: Email, Length: 9954, dtype: int64
In [142]:
list1=[]
for email in data['Email']:
    list1.append(email.split('@')[1])
In [143]:
data['temp']=list1
In [146]:
data.head(1)
Out[146]:
Address Lot AM or PM Browser Info Company Credit Card CC Exp Date CC Security Code CC Provider Email Job IP Address Language Purchase Price temp
0 16629 Pace Camp Apt. 448\nAlexisborough, NE 77... 46 in PM Opera/9.56.(X11; Linux x86_64; sl-SI) Presto/2... Martinez-Herman 6011929061123406 02/20 900 JCB 16 digit pdunlap@yahoo.com Scientist, product/process development 149.146.147.205 el 98.14 yahoo.com
In [148]:
data['temp'].value_counts().head()
Out[148]:
hotmail.com     1638
yahoo.com       1616
gmail.com       1605
smith.com         42
williams.com      37
Name: temp, dtype: int64
In [153]:
data['Email'].apply(lambda x:x.split('@')[1]).value_counts().head()
Out[153]:
hotmail.com     1638
yahoo.com       1616
gmail.com       1605
smith.com         42
williams.com      37
Name: Email, dtype: int64
In [ ]: