Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7-1 Discussion: Applied Regular Expressions Download the following two files you will need for this activity: customerData.csv This file contains randomly generated fictitious customer data.

7-1 Discussion: Applied Regular Expressions

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.

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

Python 3 / using Codio

Question:

Alright, well, after a quick glance over the .csv file and running the provided code, it seems that the financial data for "amount spent in the last 30 days" is formatted out to something like 13 decimal places. Not really sure how that happened since the "amount spent in the last 6 months" is formatted to a more logical 2 decimal places. Changing the former over to 2 decimal places will help with normalizing, ease of reading, and also help should one wish to upload that data into another equation for further calculation.

Example from file: $943.9000000000001

Please assist with this error

import csv

import re

data = [] with open('customerData.csv') as csvfile:

reader = csv.DictReader(csvfile)

for row in reader:

data.append(row)

for row in SpentPast30Days:

('SpentPast30Days') = ('formattedList')

formattedList = float["%.2f" % SpentPast30Days in SpentPast30Days in 'customerData.csv']

print

(formattedList)

SyntaxError: can't assign to literal Thank you in advance!

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_2

Step: 3

blur-text-image_3

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

The Database Experts Guide To Database 2

Authors: Bruce L. Larson

1st Edition

0070232679, 978-0070232679

More Books

Students also viewed these Databases questions

Question

=+What team structure would you choose and why?

Answered: 1 week ago

Question

1. Explain how business strategy affects HR strategy.

Answered: 1 week ago