How JustAnswer Works:
  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.
Ask active1065 Your Own Question
active1065, Engineer
Category: Homework
Satisfied Customers: 331
Experience:  Several years of experience in C# ,ASP.NET,PHP,C,C ++,SQL
Type Your Homework Question Here...
active1065 is online now
A new question is answered every 9 seconds

I have a programming assignment that is due by this Friday,

Customer Question

Hi There I have a programming assignment that is due by this Friday, 27/11/2015 - using Python, it is about Data Mining. Assignment Details: Data Mining. " Data mining is the process of sorting through large amounts of data and picking out relevant information.
In this assignment we want to do some preliminary data mining of a company's stock. This sort of data is available from, where you can, among other things, search historical data by company. For this assignment we'll look at Google from 2004
to 2012. The data-set you'll need is a table in CSV format and can be downloaded from Your program should calculate the monthly average price for Google and tell us the best and worst six-month period
for Google. The average price is defined as ((v1*c1)+(v2*c2)+(v3*c3)+(v4*c4)...+(vn*cn)) / (v1+v2+v3+v4...+vn) where vi is the volume for day i and ci is the adjusted close price for day i. " I am a first year programmer, so it needs to reflect my experience
level. Nothing to fancy. thank you in advance, and please, only take the work if you feel that you can get it to me by this Friday 27/11/2015 thanks! Robert
Submitted: 1 year ago.
Category: Homework
Customer: replied 1 year ago.
Expert:  active1065 replied 1 year ago.


I can have this ready for you. WHich version of python do you use?

Expert:  active1065 replied 1 year ago.

I can do this in python v 2.7 or version 3

Customer: replied 1 year ago.
Great! - thanks for taking this on. We use Python 3.5
Expert:  active1065 replied 1 year ago.

Cool. I will have it ready for you by today evening.

Customer: replied 1 year ago.
ok, excellent, i look forward to taking a look at it
Expert:  active1065 replied 1 year ago.

Just one clarification. Are you supposed to use any specific libraries or data structures like arrays for this one?

Expert:  active1065 replied 1 year ago.

I am not familiar with how much you have been taught in python.

Customer: replied 1 year ago.
to clarify, i have basic knowledge. We are only beginners with a few weeks experience really. the information i put in the original question is literally all we got from the lecturer for the assignment.i could send you a link to some code that my friend has submitted (he's better at it than me) - maybe that will help. But, obviously this goes without saying.. but, it cannot look anything like his work, or it will look like i copied..
Expert:  active1065 replied 1 year ago.

Gotcha. It was an easy one for me.

Try this code

let me know if you have any problem running or understanding the code.

Expert:  active1065 replied 1 year ago.

P.s Have this file in the same location or directory where in you download googlePrices.csv file to get it running.

Expert:  active1065 replied 1 year ago.

Any luck running the code?

Customer: replied 1 year ago.
Hey, sorry for the delay! - thanks very much for having this so quick. I have not had access to the Internet for a little while (traveling) - in about an hour I will have my laptop, so I will check the code then and let you know how I get on. Thanks again
Expert:  active1065 replied 1 year ago.

No problem. If you can;t access the pastebin link try this link :

Customer: replied 1 year ago.
Hi Theresorry again for my delay, i am only properly at my laptop today. I have looked at the code and compared it with my friends code, and it looks a lot is my friends code:import csvopen_file = open('googlePrices.csv', 'r')csv_file = csv.DictReader(open_file)months = ['01','02','03','04','05','06','07','08','09','10','11','12']
list_file = []
years = []
data = {}
month_avg = []# ***** csv file to list
for row in csv_file:
for row in list_file:
unique_years = sorted(set(years))for year in unique_years:
data[year] = {x:[] for x in months}
for month in months:
for row in list_file:
if(row['Date'][0:4] == year and row['Date'][5:7] == month):
data[year][month].append(float(row['Adj Close']))
if(data[year][month] == []):
data[year][month].append(0.0)month_avg.append(sum(data[year][month]) / len(data[year][month]))split_by_year = list(zip(*[iter(month_avg)]*12))first_semester = []
second_semester = []
highest = 0.0
lowest = 10000.0
best = ''
worst= ''for i, x in enumerate(unique_years):
print(x,'=',sum(split_by_year[i][:6]) ,'-',sum(split_by_year[i][6:]))
if(first_semester[i] > highest):
highest = first_semester[i]
best = 'The best 6-month period was in the First semester ' + x
if(second_semester[i] > highest):
highest = second_semester[i]
best = 'The best 6-month period was in the Second semester ' + x
if(first_semester[i] < lowest and first_semester[i] != 0.0):
lowest = first_semester[i]
worst = 'The worst 6-month period was in the First semester ' + x
if(second_semester[i] < lowest and second_semester[i] != 0.0):
lowest = second_semester[i]
worst = 'The worst 6-month period was in the Second semester ' + x
Customer: replied 1 year ago.
Is there any chance to could add some more detail to the code, similar to the above (but not the same, re copying) -- i would be very greatfull. I got an extension on the assignment but its still due tonight at 23:59 (irish time)thank you
Expert:  active1065 replied 1 year ago.

You need to spend $3 to view this post. Add Funds to your account and buy credits.