Question
Download the following two files you will need for this activity: customerData.csv This file contains randomly generated fictitious customer data. customer_regex.py This is a Python
Download the following two files you will need for this activity:
- customerData.csv
This file contains randomly generated fictitious customer data.
- customer_regex.py
This is a Python script that imports the customer data into a list of customer details.
In your personal playground in Codio, upload the two files and investigate the contents before considering the task you will pose to your peers.
Assume the position of a manager of an online retailer. Pose a question to your IT expert about a task you would like to do with the customer data files. Provide a brief explanation (two to three sentences) describing why this task might be relevant. Examples of tasks you may pose include the following:
- Correct data errors
- Normalize the format of data
- Search for certain customers based on a business need
- Identify trends based on frequency of the customers
In your responses to your peers:
- Provide the regex code that would be required to meet the task presented.
- Describe the relevance of the task: Were regular expressions the best or only way to approach the task? What other data or tasks could be used to increase effectiveness or better achieve the goal presented?
Here is the code that is given:
import csv import re data = []
with open('customerData.csv') as csvfile: reader = csv.DictReader(csvfile) for row in reader: data.append(row) print(data[0]) print(data[1]["Name"]) print(data[2]["Spent Past 30 Days"]
Here is the data from the csv file:
My question is...how can I find the highest spending customers from the past 6-12 months using findall? Thank you, in advance, for the help!!
Name Credit Card Mamie Mason Visa Dr. Jorge Leonard Sue Robertson Gilbert Houston American Express American Express Mastercard Diners Club United States & Canada Discover Card Randy Griffith Lucile Bishop male Visa Mr. Shane Hughes Larry Sparks Mastercard Dr. Sadie Hogan Visa Vera Sharp Amanda Craig Discover Card American Express Mister Arthur Wallace Discover Card Gender SSN Member Date Phone State female 459-69-6647 Mon Aug 01 2016 12:06:01 GMT-0400 (Eastern Daylight Time) 9472284457 Indiana male 267-90-8144 10/17/2015 (482) 962-5537 Pennsylvania female 431-17-5882 Fri Jun 03 2016 01:34:30 GMT-0400 (Eastern Daylight Time) (387) 395-7066 Virginia male 469-80-8860 Wed May 02 2012 00:45:29 GMT-0400 (Eastern Daylight Time) 5776043558 Kentucky male 936-86-6880 2/4/2006 (310) 611-5796 Delaware female 443-08-6297 Tue May 31 2016 06:26:56 GMT-0400 (Eastern Daylight Time) (808) 609-2200 Utah 278-42-7591 2/17/2006 3356852122 Pennsylvania male 211-00-3913 28/9/2007 6667374920 IN female 425-51-1446 Mon Jul 02 2007 21:31:31 GMT-0400 (Eastern Daylight Time) 3189038083 Kansas female 337-52-6574 7/3/2015 8676596027 C.o. female 373-59-4142 Sun Aug 17 2014 08:44:20 GMT-0400 (Eastern Daylight Time) (951) 347-3265 Michigan male 120-54-7783 13/12/2008 (562) 988-4539 W.A. male 603-37-0899 3/28/2016 8308268822 M.T. female 549-30-5657 14/7/2007 3464159274 California female 432-20-2722 Wed Apr 08 2009 12:50:08 GMT-0400 (Eastern Daylight Time) (812) 887-7136 M.S. female 937-21-8751 Sat Aug 01 2015 13:47:43 GMT-0400 (Eastern Daylight Time) (986) 478-9204 OK male 332-30-7548 14/12/2007 (919) 727-4554 Nevada female 523-10-3166 6/3/2017 8164602604 1.A. male 337-02-8478 10/3/2013 (288) 821-6886 Wyoming male 429-61-7058 2/5/2016 4058751537 R.I. male 869-64-4308 6/3/2016 (225) 276-1062 G.A. male 557-47-8699 23/10/2011 4862697087 Delaware male 852-24-7710 3/30/2012 5156863740 Pennsylvania female 325-42-5441 Sun May 21 2006 15:15:45 GMT-0400 (Eastern Daylight Time) 6254005776 Vermont male 666-06-9299 Tue Jun 14 2011 11:14:04 GMT-0400 (Eastern Daylight Time) 7449056431 K.Y. Zip Email 82439-3619 m.masonason@gig.org 44795 1.leonardeonard@leiwauhi.gov 97198 s.robertsonobertson@odejo.co 59108-0390 g.houstonouston@fuzsi.co 22646-1080 r.griffithriffith@iptiipu.ca 57189-7317 bishopishop@fudkilso.com 67098-3590 s.hughesughes@leh.net 81455-5156 1.sparksparks@gafnecnuc.au 97873-1458 s.Hogan@wo.gov 73806 v.sharpharp@vulos.edu 65251 a.craigraig@lu.nz 89954 a.wallaceallace@wiclacpud.net 88094-1943 j.estradastrada@te.info 83688-4346 o.Lee@tudde.info 03831-4171 L.Fox@kak.ca 31468-4649 1.doyleoyle@ovo.gov 47519-6358 c.powersowers@wo.org 26609-9984 s. Moran@eziwgi.co 85533 rmendezendez@ijmag.ca 61790-5160 C.Mendoza@izofera.edu 92801 m.Jenkins@ni.au 69139 v.robertsoberts@utseodu.com 39347-8948 L.kinging@ro.com 27339 v.bishopishop@vi.org 69174-1109 f.foxox@pam.co Joe Estrada Diners Club United States & Canada Ophelia Lee Diners Club United States & Canada Mastercard Mastercard Miss Leona Fox Miss Lena Doyle Curtis Powers Susie Moran Discover Card Discover Card Mister Ray Mendez Visa Clyde Mendoza Discover Card Mister Mike Jenkins Visa Mr. Vincent Roberts Mastercard Visa Lucas King Victoria Bishop Doctor Francis Fox Mastercard Discover Card Name Credit Card Mamie Mason Visa Dr. Jorge Leonard Sue Robertson Gilbert Houston American Express American Express Mastercard Diners Club United States & Canada Discover Card Randy Griffith Lucile Bishop male Visa Mr. Shane Hughes Larry Sparks Mastercard Dr. Sadie Hogan Visa Vera Sharp Amanda Craig Discover Card American Express Mister Arthur Wallace Discover Card Gender SSN Member Date Phone State female 459-69-6647 Mon Aug 01 2016 12:06:01 GMT-0400 (Eastern Daylight Time) 9472284457 Indiana male 267-90-8144 10/17/2015 (482) 962-5537 Pennsylvania female 431-17-5882 Fri Jun 03 2016 01:34:30 GMT-0400 (Eastern Daylight Time) (387) 395-7066 Virginia male 469-80-8860 Wed May 02 2012 00:45:29 GMT-0400 (Eastern Daylight Time) 5776043558 Kentucky male 936-86-6880 2/4/2006 (310) 611-5796 Delaware female 443-08-6297 Tue May 31 2016 06:26:56 GMT-0400 (Eastern Daylight Time) (808) 609-2200 Utah 278-42-7591 2/17/2006 3356852122 Pennsylvania male 211-00-3913 28/9/2007 6667374920 IN female 425-51-1446 Mon Jul 02 2007 21:31:31 GMT-0400 (Eastern Daylight Time) 3189038083 Kansas female 337-52-6574 7/3/2015 8676596027 C.o. female 373-59-4142 Sun Aug 17 2014 08:44:20 GMT-0400 (Eastern Daylight Time) (951) 347-3265 Michigan male 120-54-7783 13/12/2008 (562) 988-4539 W.A. male 603-37-0899 3/28/2016 8308268822 M.T. female 549-30-5657 14/7/2007 3464159274 California female 432-20-2722 Wed Apr 08 2009 12:50:08 GMT-0400 (Eastern Daylight Time) (812) 887-7136 M.S. female 937-21-8751 Sat Aug 01 2015 13:47:43 GMT-0400 (Eastern Daylight Time) (986) 478-9204 OK male 332-30-7548 14/12/2007 (919) 727-4554 Nevada female 523-10-3166 6/3/2017 8164602604 1.A. male 337-02-8478 10/3/2013 (288) 821-6886 Wyoming male 429-61-7058 2/5/2016 4058751537 R.I. male 869-64-4308 6/3/2016 (225) 276-1062 G.A. male 557-47-8699 23/10/2011 4862697087 Delaware male 852-24-7710 3/30/2012 5156863740 Pennsylvania female 325-42-5441 Sun May 21 2006 15:15:45 GMT-0400 (Eastern Daylight Time) 6254005776 Vermont male 666-06-9299 Tue Jun 14 2011 11:14:04 GMT-0400 (Eastern Daylight Time) 7449056431 K.Y. Zip Email 82439-3619 m.masonason@gig.org 44795 1.leonardeonard@leiwauhi.gov 97198 s.robertsonobertson@odejo.co 59108-0390 g.houstonouston@fuzsi.co 22646-1080 r.griffithriffith@iptiipu.ca 57189-7317 bishopishop@fudkilso.com 67098-3590 s.hughesughes@leh.net 81455-5156 1.sparksparks@gafnecnuc.au 97873-1458 s.Hogan@wo.gov 73806 v.sharpharp@vulos.edu 65251 a.craigraig@lu.nz 89954 a.wallaceallace@wiclacpud.net 88094-1943 j.estradastrada@te.info 83688-4346 o.Lee@tudde.info 03831-4171 L.Fox@kak.ca 31468-4649 1.doyleoyle@ovo.gov 47519-6358 c.powersowers@wo.org 26609-9984 s. Moran@eziwgi.co 85533 rmendezendez@ijmag.ca 61790-5160 C.Mendoza@izofera.edu 92801 m.Jenkins@ni.au 69139 v.robertsoberts@utseodu.com 39347-8948 L.kinging@ro.com 27339 v.bishopishop@vi.org 69174-1109 f.foxox@pam.co Joe Estrada Diners Club United States & Canada Ophelia Lee Diners Club United States & Canada Mastercard Mastercard Miss Leona Fox Miss Lena Doyle Curtis Powers Susie Moran Discover Card Discover Card Mister Ray Mendez Visa Clyde Mendoza Discover Card Mister Mike Jenkins Visa Mr. Vincent Roberts Mastercard Visa Lucas King Victoria Bishop Doctor Francis Fox Mastercard Discover CardStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started