[pandas]How to liner fit time series data and get linear fit equation and r square - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: [pandas]How to liner fit time series data and get linear fit equation and r square (/thread-17139.html) |
[pandas]How to liner fit time series data and get linear fit equation and r square - Sri - Mar-30-2019 Hi, I have below pandas dataframe: df: Time_golden Golden is_golden 0 2019 -03-20 10:24:30 98.6 golden 1 2019 -03-20 11:10:30 97.0 golden 2 2019 -03-20 13:13:30 96.0 golden 3 2019 -03-21 13:43:16 95.0 golden 4 2019 -03-23 10:37:11 94.6 golden 5 2019 -03-23 18:43:19 93.0 golden 6 2019 -03-24 22:19:43 92.0 golden 7 2019 -03-25 09:23:45 90.0 golden 8 2019 -03-26 11:42:51 89.0 golden 9 2019 -03-27 20:32:51 87.3 golden 10 2019 -03-27 23:42:51 86.0 golden 11 2019 -03-28 00:52:23 84.0 golden 12 2019 -03-28 03:40:40 82.3 goldenI want to linearly fit and get linear fit equation and r-square. I use below code but it gives an error xg=df['Time_golden'] yg=df['Golden'] plt.scatter(xg,yg)ValueError: First argument must be a sequence Kindly help how to d this, RE: [pandas]How to liner fit time series data and get linear fit equation and r square - snippsat - Mar-30-2019 Here a test. So i don't get your error,you may need to update pandas and matplotlib. RE: [pandas]How to liner fit time series data and get linear fit equation and r square - Sri - Mar-30-2019 Thanks, and how to add trend line and get equation and Rsquare. RE: [pandas]How to liner fit time series data and get linear fit equation and r square - snippsat - Mar-30-2019 (Mar-30-2019, 05:08 PM)Sri Wrote: Thanks, and how to add trend line and get equation and Rsquare.Give it a shot and post back code,also search for those method,i would also need to search for those task. RE: [pandas]How to liner fit time series data and get linear fit equation and r square - scidam - Mar-31-2019 Note, you measurements are taken irregularly in time; first three seems to belong the same day, March, 20, but others are distributed over a week (until March, 28). It is likely, that dates were not recognized properly in the previous posts; Look at the following solution. RE: [pandas]How to liner fit time series data and get linear fit equation and r square - Sri - Apr-04-2019 Thanks, |