GithubHelp home page GithubHelp logo

New to Prophet about prophet HOT 3 OPEN

NickR001 avatar NickR001 commented on April 28, 2024
New to Prophet

from prophet.

Comments (3)

Vaslo avatar Vaslo commented on April 28, 2024

Hi,

So I wanted to forecast some figures based on last years data...I have installed Prophet and using Notebook Jupyter

I can run these commands where I see the first 4 lines of the imported CSV sheet.

import pandas as pd

df = pd.read_csv(r'C:\Users\Public\Meds.csv',header=None)

df.head()

When trying to run anything with Prophet i.e m = Prophet() I get

NameError Traceback (most recent call last)

Cell In[109], line 1

----> 1 m = prophet()

NameError: name 'prophet' is not defined

Any help would be appreciated or sign posted towards a forum that may be able to offer some assistance. Thanks,

Are you sure you have done 'pip install prophet'? And if so have your made sure to import prophet at the top of your code?

Make sure to check the quick start:
quick start

from prophet.

NickR001 avatar NickR001 commented on April 28, 2024

Hi Vaslo,

I found this blog and started again https://blog.quantinsti.com/installing-prophet-library-windows/ and all seems okay at least nothing failed when installing!

I can run the command m = Prophet() in Notebook and doesn't complain now but my datasheet doesn't pass the fit test. I take this as a success but now need to work out why it doesn't like my datasheet as both coloums have ds (for dates) and y (for the figures) in the first cell of the spreadsheet as shown below when running the commands

import pandas as pd
df = pd.read_csv(r'C:\Users\Public\Meds.csv',header=None)
df.head()

0	1

0 ds y
1 01/01/2023 102
2 02/01/2023 114
3 03/01/2023 123
4 04/01/2023 116

m.fit(df) output

ValueError Traceback (most recent call last)
Cell In[133], line 1
----> 1 m.fit(df)

File ~\AppData\Local\anaconda3\Lib\site-packages\prophet\forecaster.py:1117, in Prophet.fit(self, df, **kwargs)
1114 raise Exception('Prophet object can only be fit once. '
1115 'Instantiate a new object.')
1116 if ('ds' not in df) or ('y' not in df):
-> 1117 raise ValueError(
1118 'Dataframe must have columns "ds" and "y" with the dates and '
1119 'values respectively.'
1120 )
1121 history = df[df['y'].notnull()].copy()
1122 if history.shape[0] < 2:

ValueError: Dataframe must have columns "ds" and "y" with the dates and values respectively.

from prophet.

gvas7 avatar gvas7 commented on April 28, 2024

Hi NickR001,

Without seeing your actual data, I think you might want your read_csv to be have a header for row 1 so that your dataframe should have ds and y as the first line when you read the head of the dataframe, and then your data will follow from there. This is more of a pandas issue rather than prophet, so once that is right you can at least get a simple model.

from prophet.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.