Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python programming- 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

Python programming-

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.

My classmate asked me to figure out the which state has the most customers. Or in other words, which state shows up the most in the cvs data. I've thought about making a full list of the states to narrow the list but that seems a little excessive. What's the best way to do this?

Here is the code from the first link:

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"])

customerdata.csv is a large file, I will simply copy and paste a small section of it, enough to answer the question:

Name Gender SSN Member Date Phone State Zip Email Credit Card Credit Card_Number Credit Card Exp Gender Favorite Radio Station Purchases Past 30 Days Spent Past 30 Days Purchases Past 6 Months Spent Past 6 Months Purchases Past 12 Months Spent Past 12 Months
Mamie Mason female 459-69-6647 Mon Aug 01 2016 12:06:01 GMT-0400 (Eastern Daylight Time) 9.47E+09 Indiana 82439-3619 m.masonason@gig.org Visa 4263xxxxxxxx1913 23-Sep female WMMZ 4 ######## 7 ######## 9 ########
Dr. Jorge Leonard male 267-90-8144 ######## (482) 962-5537 Pennsylvania 44795 j.leonardeonard@leiwauhi.gov American Express 3430xxxxxxx6344 22-Jun male WLRS 4 ######## 5 ######## 15 ########
Sue Robertson female 431-17-5882 Fri Jun 03 2016 01:34:30 GMT-0400 (Eastern Daylight Time) (387) 395-7066 Virginia 97198 s.robertsonobertson@odejo.co American Express 3446xxxxxxx4624 21-Sep female WING 4 ######## 9 ######## 13 ########
Gilbert Houston male 469-80-8860 Wed May 02 2012 00:45:29 GMT-0400 (Eastern Daylight Time) 5.78E+09 Kentucky 59108-0390 g.houstonouston@fuzsi.co Mastercard 5149xxxxxxxx7215 26-Jul male WOGV 0 $0 5 ######## 6 ########
Randy Griffith male 936-86-6880 2/4/2006 (310) 611-5796 Delaware 22646-1080 r.griffithriffith@iptiipu.ca Diners Club United States & Canada 5430xxxxxxxx1269 22-Jan male WJMP 4 ######## 8 ######## 10 ########
Lucile Bishop female 443-08-6297 Tue May 31 2016 06:26:56 GMT-0400 (Eastern Daylight Time) (808) 609-2200 Utah 57189-7317 l.bishopishop@fudkilso.com Discover Card 6011xxxxxxxx4095 25-Mar female KACJ 1 $869.04 5 ######## 6 ########
Mr. Shane Hughes male 278-42-7591 ######## 3.36E+09 Pennsylvania 67098-3590 s.hughesughes@leh.net Visa 4694xxxxxxxx8259 23-Jun male WJTV 2 ######## 7 ######## 8 ########

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions