{"id":46666,"date":"2021-09-30T00:00:00","date_gmt":"2021-09-30T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/sales-forecasting-with-python-and-griddb\/"},"modified":"2025-11-13T12:55:35","modified_gmt":"2025-11-13T20:55:35","slug":"sales-forecasting-with-python-and-griddb","status":"publish","type":"post","link":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/","title":{"rendered":"Sales Forecasting with Python and GridDB"},"content":{"rendered":"<p>Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the profitability of many companies and is thus an important skill to learn. It helps guide planning and direction for the company. There are several methods out there like Autoregressive Integrated Moving Average (ARIMA), Seasonal Autoregressive Integrated Moving-Average (SARIMA), Vector several (VAR), and so on. In this post we will use Keras for implementing a Long Short-term Memory (LSTM) model. LSTMs are a class of neural networks that are robust to feedback loops.<\/p>\n<p>One for the main problems with Recurrent Neural networks is that over time, the information maintained in the hidden state gets overloaded. LSTMs maintain a additional hidden state that persists from step to step, this helps with the overloading. More details about LSTMs can be found <a href=\"https:\/\/direct.mit.edu\/neco\/article\/9\/8\/1735\/6109\/Long-Short-Term-Memory\">here<\/a>. We will use GridDB which is highly scalable and ensures high reliability, as a result it can serve as a great database for neural networks training and inference. Installing GridDB is simple and is well documented <a href=\"https:\/\/docs.griddb.net\/gettingstarted\/python\/\">here<\/a>. To check out the python-GridDB client please refer to <a href=\"https:\/\/www.youtube.com\/watch?v=yWCVfLoV9_0&amp;t=61s\">this video<\/a>.<\/p>\n<h2>LSTM<\/h2>\n<h2>Setup<\/h2>\n<p>Let us setup GridDB first!<\/p>\n<h3>Quick setup of GridDB Python Client on Ubuntu 20.04:<\/h3>\n<ul>\n<li>Install GridDB <\/li>\n<\/ul>\n<p>Download and install the deb from <a href=\"https:\/\/griddb.net\/en\/downloads\/\">here<\/a>.<\/p>\n<ul>\n<li>Install C client <\/li>\n<\/ul>\n<p>Download and install the Ubuntu from <a href=\"https:\/\/software.opensuse.org\/download\/package?project=home:knonomura&amp;package=griddb-c-client\">here<\/a>.<\/p>\n<ul>\n<li>Install requirements <\/li>\n<\/ul>\n<p>1) Swig console wget https:\/\/github.com\/swig\/swig\/archive\/refs\/tags\/v4.0.2.tar.gz tar xvfz v4.0.2.tar.gz cd swig-4.0.2 .\/autogen.sh .\/configure make<\/p>\n<p>2) Install python client<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">\nwget  \nhttps:\/\/github.com\/griddb\/python_client\/archive\/refs\/tags\/0.8.4.zip \nunzip . 0.8.4.zip <\/code><\/pre>\n<\/div>\n<p>Make sure you have python-dev installed for the corresponding python version. We will use python 3.8 for this post.<\/p>\n<p>3) We also need to point to the correct locations<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">\nexport CPATH=$CPATH:&lt;python header file directory path> \nexport LIBRARY_PATH=$LIBRARY_PATH:&lt;c client library file directory path> \n&lt;\/c>&lt;\/python><\/code><\/pre>\n<\/div>\n<p>We can also use GridDB with docker as shown <a href=\"https:\/\/griddb.net\/en\/blog\/running-griddb-in-docker\/\">here<\/a><\/p>\n<h3>Python libraries<\/h3>\n<p>Next we install the python libraries. Installing plotly, numpy, keras, tensorflow and pandas is a simple pip install.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">pip install keras \npip install numpy \npip install tensorflow \npip install plotly \npip install pandas <\/code><\/pre>\n<\/div>\n<h2>Prediction<\/h2>\n<h3>Step 1: Downloading Dataset<\/h3>\n<p>we can download the data from this <a href=\"https:\/\/www.kaggle.com\/kyanyoga\/sample-sales-data\/code\">Kaggle project<\/a>. The dataset contains Order Info, Sales, Customer, Shipping, etc., and can be used for Segmentation, customer analytics, clustering and so on. We will use it for sales forecasting, so we are only concerned with sales and order dates. We will predict monthly sales.<\/p>\n<h3>Step 2: Importing Libraries<\/h3>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">\nimport numpy as np \nimport pandas as pd \nimport plotly.offline as pyoff \nimport plotly.graph_objs as go \n<\/code><\/pre>\n<\/div>\n<h3>Step 3: Data Loading and Processing<\/h3>\n<h4>Loading Data<\/h4>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">data=pd.read_csv('\/content\/sales_data_sample.csv', encoding='cp1252') <\/code><\/pre>\n<\/div>\n<p>Note the encoding option used above.<\/p>\n<p>Alternatively, we can use GridDB to get this data frame.<\/p>\n<h4>Feature Encoding<\/h4>\n<p>First, we collate the data at the monthly level. We simply se the date for each day to the first day of the month. Then we make average sales in the month. Note that not all days will have sales in each month.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">data['ORDERDATE'] = pd.to_datetime(data['ORDERDATE']) \ndata['ORDERDATE'] = data['ORDERDATE'].dt.year.astype('str') + '-' + data['ORDERDATE'].dt.month.astype('str') + '-01' \ndata['ORDERDATE'] = pd.to_datetime(data['ORDERDATE']) \ndata = data.groupby('ORDERDATE').SALES.mean().reset_index() \n<\/code><\/pre>\n<\/div>\n<p>Next, we plot the sales. We see some seasonality in the data, especially around the month of November.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">plot_data = [ \n    go.Scatter( \n        x=data['ORDERDATE'], \n        y=data['SALES'], \n    ) \n] \nplot_layout = go.Layout( \n        title='Monthly Sales' \n    ) \nfig = go.Figure(data=plot_data, layout=plot_layout) \npyoff.iplot(fig) <\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/1.png\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/1.png\" alt=\"\" width=\"1818\" height=\"433\" class=\"aligncenter size-full wp-image-27787\" srcset=\"\/wp-content\/uploads\/2021\/09\/1.png 1818w, \/wp-content\/uploads\/2021\/09\/1-300x71.png 300w, \/wp-content\/uploads\/2021\/09\/1-1024x244.png 1024w, \/wp-content\/uploads\/2021\/09\/1-768x183.png 768w, \/wp-content\/uploads\/2021\/09\/1-1536x366.png 1536w, \/wp-content\/uploads\/2021\/09\/1-600x143.png 600w\" sizes=\"(max-width: 1818px) 100vw, 1818px\" \/><\/a><\/p>\n<p>Next, we add a column for the difference of the sales, and drop the nulls, only the last values will be null as we cannot make a difference for that. The we create a few lags; lags allow the model to learn from not just the last but also the sales from before.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">df_supervised = data.copy() \ndf_supervised['prev_sales'] = df_supervised['SALES'].shift(1) \ndf_supervised['diff'] = (df_supervised['SALES'] - df_supervised['prev_sales'])\ndf_supervised = df_supervised.drop(['prev_sales'],axis=1) \nfor inc in range(1,3): \n    field_name = 'lag_' + str(inc) \n    df_supervised[field_name] = df_supervised['diff'].shift(inc) \n#drop null values \ndf_supervised = df_supervised.dropna().reset_index(drop=True) \n<\/code><\/pre>\n<\/div>\n<h4>Splitting Data into Validation and Train<\/h4>\n<p>Next, we split the data into tests and train. We have used the last 6 months to test.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">\nfrom sklearn.preprocessing import MinMaxScaler \ndf_model = df_supervised.drop(['SALES','ORDERDATE'],axis=1) \n#split train and test set \ntrain_set, test_set = df_model[0:-6].values, df_model[-6:].values \n<\/code><\/pre>\n<\/div>\n<p>We will also scale the data. Note that we scale the test and the train set separately. This is done so that the train and test sets remain independent.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">#apply Min Max Scaler \nscaler = MinMaxScaler(feature_range=(-1, 1)) \nscaler = scaler.fit(train_set) \n# reshape training set \ntrain_set = train_set.reshape(train_set.shape[0], train_set.shape[1]) \ntrain_set_scaled = scaler.transform(train_set) \n# reshape test set \ntest_set = test_set.reshape(test_set.shape[0], test_set.shape[1]) \ntest_set_scaled = scaler.transform(test_set) <\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">X_train, y_train = train_set_scaled[:, 1:], train_set_scaled[:, 0:1] \nX_train = X_train.reshape(X_train.shape[0], 1, X_train.shape[1]) \nX_test, y_test = test_set_scaled[:, 1:], test_set_scaled[:, 0:1] \nX_test = X_test.reshape(X_test.shape[0], 1, X_test.shape[1]) <\/code><\/pre>\n<\/div>\n<h3>Step 4: Prediction<\/h3>\n<p>Next, we start the prediction process.<\/p>\n<h4>Initializing<\/h4>\n<p>We first create an LSTM model in Keras. for that we use the <code>LSTM<\/code> layer.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\"># define the keras model \nfrom keras.models import Sequential \nfrom keras.layers import LSTM, Dense \nmodel = Sequential() \nmodel.add(LSTM(4, batch_input_shape=(1, X_train.shape[1], X_train.shape[2]), stateful=True)) \nmodel.add(Dense(1)) <\/code><\/pre>\n<\/div>\n<h4>Training<\/h4>\n<p>Next, we compile the model. We use the mean_squared_error as the loss and evaluate it on accuracy.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy']) <\/code><\/pre>\n<\/div>\n<p>Next, we train the model for 100 epochs.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">history=model.fit(X_train, y_train, epochs=100, batch_size=1, verbose=1, shuffle=False) <\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">Epoch 72\/100 \n\n20\/20 [==============================] - 0s 2ms\/step - loss: 0.1302 - accuracy: 0.0000e+00 \nEpoch 73\/100 \n20\/20 [==============================] - 0s 2ms\/step - loss: 0.1287 - accuracy: 0.0000e+00 \nEpoch 74\/100 \n20\/20 [==============================] - 0s 2ms\/step - loss: 0.1272 - accuracy: 0.0000e+00 \nEpoch 75\/100 \n20\/20 [==============================] - 0s 2ms\/step - loss: 0.1258 - accuracy: 0.0000e+00 \nEpoch 76\/100 \n20\/20 [==============================] - 0s 2ms\/step - loss: 0.1244 - accuracy: 0.0000e+00 <\/code><\/pre>\n<\/div>\n<h4>Evaluation and Predictions<\/h4>\n<p>Finally, we evaluate the test set, then we rescale the predictions and plot it along with the ground truth.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">y_pred = model.predict(X_test,batch_size=1) \ny_pred = y_pred.reshape(y_pred.shape[0], 1, y_pred.shape[1]) \n\npred_test_set = [] \nfor index in range(0,len(y_pred)): \n    pred_test_set.append(np.concatenate([y_pred[index],X_test[index]],axis=1)) \n\npred_test_set = np.array(pred_test_set) \npred_test_set = pred_test_set.reshape(pred_test_set.shape[0], pred_test_set.shape[2]) \npred_test_set_inverted = scaler.inverse_transform(pred_test_set) \n\nresult_list = [] \nsales_dates = list(data[-7:].ORDERDATE) \nact_sales = list(data[-7:].SALES) \nfor index in range(0,len(pred_test_set_inverted)): \n    result_dict = {} \n    result_dict['pred_value'] = int(pred_test_set_inverted[index][0] + act_sales[index]) \n    result_dict['ORDERDATE'] = sales_dates[index] \n    result_list.append(result_dict) \n\ndf_result = pd.DataFrame(result_list) <\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-python\">#merge with actual sales dataframe \ndf_sales_pred = pd.merge(data,df_result,on='ORDERDATE',how='left') \n#plot actual and predicted \nplot_data = [ \n    go.Scatter( \n        x=df_sales_pred['ORDERDATE'], \n        y=df_sales_pred['SALES'], \n        name='actual' \n    ), \n        go.Scatter( \n        x=df_sales_pred['ORDERDATE'], \n        y=df_sales_pred['pred_value'], \n        name='predicted' \n    ) \n] \nplot_layout = go.Layout( \n        title='Sales Prediction' \n    ) \nfig = go.Figure(data=plot_data, layout=plot_layout) \npyoff.iplot(fig) <\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/predicted.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/predicted.png\" alt=\"\" width=\"1818\" height=\"433\" class=\"aligncenter size-full wp-image-27786\" srcset=\"\/wp-content\/uploads\/2021\/09\/predicted.png 1818w, \/wp-content\/uploads\/2021\/09\/predicted-300x71.png 300w, \/wp-content\/uploads\/2021\/09\/predicted-1024x244.png 1024w, \/wp-content\/uploads\/2021\/09\/predicted-768x183.png 768w, \/wp-content\/uploads\/2021\/09\/predicted-1536x366.png 1536w, \/wp-content\/uploads\/2021\/09\/predicted-600x143.png 600w\" sizes=\"(max-width: 1818px) 100vw, 1818px\" \/><\/a><\/p>\n<p>We see that the predictions are close. and off by a few 100. This shows the power of forecasting where we can get a close enough prediction in a matter of minutes with a quite simple model.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this post we learned how to train an LSTM forecasting model with Keras, python and gridDB.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the profitability of many companies and is thus an important skill to learn. It helps guide planning and direction for the company. There are several methods out there like Autoregressive Integrated Moving [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":27810,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46666","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.1.1 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\" \/>\n<meta property=\"og:site_name\" content=\"GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/griddbcommunity\/\" \/>\n<meta property=\"article:published_time\" content=\"2021-09-30T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:55:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/sales.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1160\" \/>\n\t<meta property=\"og:image:height\" content=\"653\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"griddb-admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:site\" content=\"@GridDBCommunity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"griddb-admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Sales Forecasting with Python and GridDB\",\"datePublished\":\"2021-09-30T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:35+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\"},\"wordCount\":694,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2021\/09\/sales.png\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\",\"url\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\",\"name\":\"Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2021\/09\/sales.png\",\"datePublished\":\"2021-09-30T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:35+00:00\",\"description\":\"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2021\/09\/sales.png\",\"contentUrl\":\"\/wp-content\/uploads\/2021\/09\/sales.png\",\"width\":1160,\"height\":653},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/\",\"name\":\"GridDB: Open Source Time Series Database for IoT\",\"description\":\"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL\",\"publisher\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"contentUrl\":\"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png\",\"width\":200,\"height\":83,\"caption\":\"Fixstars\"},\"image\":{\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/griddbcommunity\/\",\"https:\/\/x.com\/GridDBCommunity\",\"https:\/\/www.linkedin.com\/company\/griddb-by-toshiba\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g\",\"caption\":\"griddb-admin\"},\"url\":\"https:\/\/griddb.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT","description":"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/","og_locale":"en_US","og_type":"article","og_title":"Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT","og_description":"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the","og_url":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2021-09-30T07:00:00+00:00","article_modified_time":"2025-11-13T20:55:35+00:00","og_image":[{"width":1160,"height":653,"url":"https:\/\/griddb.net\/wp-content\/uploads\/2021\/09\/sales.png","type":"image\/png"}],"author":"griddb-admin","twitter_card":"summary_large_image","twitter_creator":"@GridDBCommunity","twitter_site":"@GridDBCommunity","twitter_misc":{"Written by":"griddb-admin","Est. reading time":"7 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Sales Forecasting with Python and GridDB","datePublished":"2021-09-30T07:00:00+00:00","dateModified":"2025-11-13T20:55:35+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/"},"wordCount":694,"commentCount":0,"publisher":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2021\/09\/sales.png","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/","url":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/","name":"Sales Forecasting with Python and GridDB | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2021\/09\/sales.png","datePublished":"2021-09-30T07:00:00+00:00","dateModified":"2025-11-13T20:55:35+00:00","description":"Sales forecasting is processing of estimating future sales for a given period based on past data. Forecasting is a valuable tool that dictates the","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/blog\/sales-forecasting-with-python-and-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2021\/09\/sales.png","contentUrl":"\/wp-content\/uploads\/2021\/09\/sales.png","width":1160,"height":653},{"@type":"WebSite","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#website","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/","name":"GridDB: Open Source Time Series Database for IoT","description":"GridDB is an open source time-series database with the performance of NoSQL and convenience of SQL","publisher":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/","url":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","contentUrl":"https:\/\/griddb.net\/wp-content\/uploads\/2019\/04\/fixstars_logo_web_tagline.png","width":200,"height":83,"caption":"Fixstars"},"image":{"@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/griddbcommunity\/","https:\/\/x.com\/GridDBCommunity","https:\/\/www.linkedin.com\/company\/griddb-by-toshiba"]},{"@type":"Person","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/en\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/5bceca1cafc06886a7ba873e2f0a28011a1176c4dea59709f735b63ae30d0342?s=96&d=mm&r=g","caption":"griddb-admin"},"url":"https:\/\/griddb.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46666","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46666"}],"version-history":[{"count":1,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46666\/revisions"}],"predecessor-version":[{"id":51341,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/posts\/46666\/revisions\/51341"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/media\/27810"}],"wp:attachment":[{"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46666"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46666"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46666"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}