On 08/31/2017 05:35 AM, Ode Idoko wrote:
I am running a master degree programme and very new to programming including python. I have been given a project to write a python program on exponential smoothing of some selected stocks. The program should user the user to input alpha, display the graph of the original data and "smoothed data". On the same python program, I am to develop a linear regression model to predict the next period, showing correlation coefficients to indicate the strength of the model. I have been able to write a program which returns some values but no graph and also having difficulties with the linear regression. This is the program I wrote: def exponential_smoothing (a,y,f): ans = (a*y) + (1-a) * f return ans print ("Exponential_Smoothing Program") a = float(input("please enter a: ")) y = float(input("please enter y: ")) f = float(input("please enter f: ")) ans = exponential_smoothing (a,y,f) print ("the answers are %.2f" %(ans)) Could someone kindly help with tips on how to go about this?
It's time to introduce yourself to Python's data analysis toolkit. Numpy, Scipy, Matplotlib and, if you're going to be doing stocks, Pandas.
There's a LOT there between them, it's a bit of a drink from the firehose problem. I like Wes McKinney's "Python for Data Analysis" book and consider it a good investment if you need to get up to speed on this stuff.
-- Rob Gaddi, Highland Technology -- www.highlandtechnology.com Email address domain is currently out of order. See above to fix. -- https://mail.python.org/mailman/listinfo/python-list