{"id":46669,"date":"2021-10-20T00:00:00","date_gmt":"2021-10-20T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/predictive-maintenance-with-python-and-griddb\/"},"modified":"2025-11-13T12:55:37","modified_gmt":"2025-11-13T20:55:37","slug":"predictive-maintenance-with-python-and-griddb","status":"publish","type":"post","link":"https:\/\/www.griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/","title":{"rendered":"Predictive Maintenance with Python and GridDB"},"content":{"rendered":"<p>Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot be too late as it is risky. Thus, &#8220;when&#8221; to repair is an important problem.<\/p>\n<p>Predictive maintenance is a way to predict or forecast the probability of breakdown of a fixed asset. Predictive maintenance is important for all kinds of businesses, from a large company predicting the breakdown of motors to a small businesses predicting the breakdown of printers. It can also be used to save lives for example predict the likelihood of a factory machine breakdowns or even gas leaks.<\/p>\n<p>Traditionally predictive modelling is done with feature engineering and simple regression models, however these methods are difficult to reuse. We will use a more advanced <a href=\"https:\/\/direct.mit.edu\/neco\/article\/9\/8\/1735\/6109\/Long-Short-Term-Memory\">LSTM models<\/a>. LSTMs have the ability to use sequences of data to make predictions on a rolling basis. The sequence of data can as small as 5 and as large as 100. For the data backend, we will use GridDB which is highly scalable and ensures high reliability. 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>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<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">wget https:\/\/github.com\/swig\/swig\/archive\/refs\/tags\/v4.0.2.tar.gz \ntar xvfz v4.0.2.tar.gz \ncd swig-4.0.2 \n.\/autogen.sh \n.\/configure \nmake \n<\/code><\/pre>\n<\/div>\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 \n<\/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\">export CPATH=$CPATH:&lt;python header file directory path> \nexport LIBRARY_PATH=$LIBRARY_PATH:&lt;c client library file directory path> \n\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 numpy, keras, tensorflow, sklearn 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 pandas \npip install sklearn\n<\/code><\/pre>\n<\/div>\n<h2>Predictive Modelling<\/h2>\n<h3>Step 1: Downloading Dataset<\/h3>\n<p>We use a subset of the <a href=\"https:\/\/data.nasa.gov\/dataset\/Turbofan-engine-degradation-simulation-data-set\/vrks-gjie\">NASA turbofan dataset<\/a> that can be downloaded from this <a href=\"https:\/\/www.kaggle.com\/nafisur\/dataset-for-predictive-maintenance\">Kaggle project<\/a>. The data has the unit number, times in cycles, three operational settings and 21 sensor measurements. The train\/test files have cycles so far and the truth file has the total number of cycles it can run.<\/p>\n<h3>Step 2: Importing Libraries<\/h3>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\"> \nimport pandas as pd\nimport numpy as np\nfrom sklearn.preprocessing import MinMaxScaler\nfrom sklearn.metrics import confusion_matrix, recall_score, precision_score\n\nfrom keras.models import Sequential\nfrom keras.layers import Dense, Dropout, LSTM, Activation\nfrom keras.callbacks import EarlyStopping\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-py\"> \ndataset_train = pd.read_csv('\/content\/PM_train.txt',sep=' ',header=None).dropna(axis=1)\ndataset_test  = pd.read_csv('\/content\/PM_test.txt',sep=' ',header=None).dropna(axis= 1)\ndataset_truth = pd.read_csv('\/content\/PM_truth.txt',sep=' ',header=None).dropna(axis=1)\n<\/code><\/pre>\n<\/div>\n<p>Alternatively, we can use GridDB to get this data frame.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\"> import griddb_python as griddb\n\n# Initialize container\ngridstore = factory.get_store(host= host, port=port, \n            cluster_name=cluster_name, username=uname, \n            password=pwd)\n\nconInfo = griddb.ContainerInfo(\"attrition\",\n                    [[\"id\", griddb.Type.LONG],\n                    [\"cycle\",griddb.Type.LONG],\n              .... #for all 23 variables      \n                    griddb.ContainerType.COLLECTION, True)\n                    \ncont = gridstore.put_container(conInfo) \ncont.create_index(\"id\", griddb.IndexType.DEFAULT)\n<\/code><\/pre>\n<\/div>\n<p>now we rename the columns for easy identification<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\"> \nfeatures_col_name = ['os1','os2','os3','s1','s2','s3','s4','s5','s6','s7','s8','s9','s10','s11','s12','s13','s14','s15','s16','s17','s18','s19','s20','s21']\ncol_names = ['id','cycletime'] + features_col_name\ndataset_train.columns = col_names\n\n#renaming columns\ndataset_test.columns=col_names\ndataset_train.columns=col_names\n<\/code><\/pre>\n<\/div>\n<p>We do the same for the truth file.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">dataset_truth.columns=['rul']\ndataset_truth['id']=dataset_truth.index+1\n<\/code><\/pre>\n<\/div>\n<p>Next we generate the labels. We want to predict failure in the next 15 days. The data is structured such that that last cycle run is the point of failure. However in the test set the last datapoint is not present and that is available in the truth dataset. So, first we take the total cycles run so far, add the cycles left from the truth dataset to get the total time of failure. Finally we subtract the total time left with current time to get time to failure.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">#get cycles left for train\ndataset_train['ttf'] = dataset_train.groupby(['id'])['cycletime'].transform(max) - dataset_train['cycletime']\n\n# generate column max for test data\nrul = dataset_test.groupby('id')['cycletime'].max().reset_index()\ndataset_test['ttf'] = dataset_train.groupby(['id'])['cycletime'].transform(max) - dataset_train['cycletime']\ndataset_truth['rtf'] = dataset_truth['rul'] + rul['cycletime']\ndataset_test = dataset_test.merge(pm_truth , on=['id'],how='left')\ndataset_test['ttf'] = dataset_test['rtf'] - dataset_test['cycletime']\ndataset_test.drop('rtf', axis=1, inplace=True)\n<\/code><\/pre>\n<\/div>\n<p>Next we assign labels based on prediction period<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">period=15\n\ndataset_train['label'] = dataset_train['ttf'].apply(lambda x: 1 if x &lt;= period else 0)\ndataset_test['label'] = dataset_test['ttf'].apply(lambda x: 1 if x &lt;= period else 0)\ndataset_train.head()\n<\/code><\/pre>\n<\/div>\n<p>Next, we scale the data as LSTM requires data to be scaled<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">sc=MinMaxScaler()\ndataset_train[features_col_name]=sc.fit_transform(dataset_train[features_col_name])\ndataset_test[features_col_name]=sc.transform(dataset_test[features_col_name])\n<\/code><\/pre>\n<\/div>\n<p>Next, we choose how many datapoints to use for LSTM. we can use 50 predictions. For this, we group the training data in groups of 50.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">def gen_sequence(id_df, seq_length, seq_cols):\n    df_zeros=pd.DataFrame(np.zeros((seq_length-1, id_df.shape[1])),columns=id_df.columns)\n    id_df=df_zeros.append(id_df,ignore_index=True)\n    data_array = id_df[seq_cols].values\n    num_elements = data_array.shape[0]\n    la=[]\n    for start, stop in zip(range(0, num_elements-seq_length), range(seq_length, num_elements)):\n        la.append(data_array[start:stop, :])\n    return np.array(la)\n\n\n#generate train data\nX_train=np.concatenate(list(list(gen_sequence(dataset_train[dataset_train['id']==id], seq_length, seq_cols))\n                         for id in dataset_train['id'].unique()))\ny_train=np.concatenate(list(list(gen_sequence(dataset_train[dataset_train['id']==id], seq_length,['label'])) \n                         for id in dataset_train['id'].unique())).max(axis =1)\n\n# generate test data\nX_test=np.concatenate(list(list(gen_sequence(dataset_test[dataset_test['id']==id], seq_length, seq_cols)) \n                         for id in dataset_test['id'].unique()))\nprint(X_test.shape)\n\ny_test=np.concatenate(list(list(gen_sequence(dataset_test[dataset_test['id']==id], seq_length, ['label'])) \n                        for id in dataset_test['id'].unique())).max(axis =1)\nprint(y_test.shape)\n<\/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-py\"> \nnb_features =X_train.shape[2]\n\ntimestamp=seq_length\n\nmodel = Sequential()\n\nmodel.add(LSTM(\n         input_shape=(timestamp, nb_features),\n         units=100,\n         return_sequences=True))\nmodel.add(Dropout(0.2))\n\nmodel.add(LSTM(\n          units=seq_length,\n          return_sequences=False))\nmodel.add(Dropout(0.2))\n\nmodel.add(Dense(units=1, activation='sigmoid'))\nmodel.compile(loss='binary_crossentropy', optimizer='adam', metrics=['accuracy'])\n\nmodel.summary()\n<\/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-py\"> # fit the network\nmodel.fit(X_train, y_train, epochs=10, batch_size=200, validation_split=0.05, verbose=1,\n          callbacks = [EarlyStopping(monitor='val_loss', min_delta=0, patience=0, verbose=0, mode='auto')])\n <\/code><\/pre>\n<\/div>\n<p>Next, we train the model for 100 epochs.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\"> \nhistory=model.fit(X_train, y_train, epochs=100, batch_size=1, verbose=1, shuffle=False) \n<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">Epoch 1\/10\n98\/98 [==============================] - 28s 250ms\/step - loss: 0.1596 - accuracy: 0.9394 - val_loss: 0.0611 - val_accuracy: 0.9679\n<\/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-py\">y_prob=model.predict(X_test)\ny_classes = y_prob.argmax(axis=-1)\nprint('Accuracy of model on test data: ',accuracy_score(y_test,y_classes))\n<\/code><\/pre>\n<\/div>\n<div class=\"clipboard\">\n<pre><code class=\"language-bash\">\nAccuracy of model on test data:  0.9744536780547861\n <\/code><\/pre>\n<\/div>\n<p>We can also calculate the probability of failure for every machine as follows:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-py\">machine_id = 1\nmachine_df=df_test[df_test.id==machine_id]\nmachine_test=gen_sequence(machine_df,seq_length,seq_cols)\nm_pred=model.predict(machine_test)\nfailure_prob=list(m_pred[-1]*100)[0]\n<\/code><\/pre>\n<\/div>\n<p>failure prob is 0.15824139<\/p>\n<p>Now we can play around with the prediction period, the interval for LSTM and the number of varaibles used to even get better results.<\/p>\n<h2>Conclusion<\/h2>\n<p>In this post we learned how to train an LSTM predictive maintenance model with Keras, python and GridDB. We can get a predictive accuracy of ~97% with a few lines of code.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot be too late as it is risky. Thus, &#8220;when&#8221; to repair is an important problem. Predictive maintenance is a way to predict or forecast the probability [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":27842,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46669","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>Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot\" \/>\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\/predictive-maintenance-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=\"Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot\" \/>\n<meta property=\"og:url\" content=\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-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-10-20T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:55:37+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.griddb.net\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"683\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\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\/predictive-maintenance-with-python-and-griddb\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Predictive Maintenance with Python and GridDB\",\"datePublished\":\"2021-10-20T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:37+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/\"},\"wordCount\":673,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/\",\"url\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/\",\"name\":\"Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg\",\"datePublished\":\"2021-10-20T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:55:37+00:00\",\"description\":\"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg\",\"contentUrl\":\"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg\",\"width\":1024,\"height\":683},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/griddb.net\/en\/#website\",\"url\":\"https:\/\/griddb.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.net\/en\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/griddb.net\/en\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/griddb.net\/en\/#organization\",\"name\":\"Fixstars\",\"url\":\"https:\/\/griddb.net\/en\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.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.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.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\",\"name\":\"griddb-admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/griddb.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:\/\/www.griddb.net\/en\/author\/griddb-admin\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT","description":"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot","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\/predictive-maintenance-with-python-and-griddb\/","og_locale":"en_US","og_type":"article","og_title":"Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT","og_description":"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot","og_url":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-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-10-20T07:00:00+00:00","article_modified_time":"2025-11-13T20:55:37+00:00","og_image":[{"width":1024,"height":683,"url":"https:\/\/www.griddb.net\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg","type":"image\/jpeg"}],"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\/predictive-maintenance-with-python-and-griddb\/#article","isPartOf":{"@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Predictive Maintenance with Python and GridDB","datePublished":"2021-10-20T07:00:00+00:00","dateModified":"2025-11-13T20:55:37+00:00","mainEntityOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/"},"wordCount":673,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/","url":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/","name":"Predictive Maintenance with Python and GridDB | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage"},"image":{"@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg","datePublished":"2021-10-20T07:00:00+00:00","dateModified":"2025-11-13T20:55:37+00:00","description":"Every asset has a life cycle and thus requires frequent maintenance. However, we may not want to spend resources too soon as that is a waste and we cannot","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.net\/en\/blog\/predictive-maintenance-with-python-and-griddb\/#primaryimage","url":"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg","contentUrl":"\/wp-content\/uploads\/2021\/10\/4381851322_d46fd7d75e_b-1.jpg","width":1024,"height":683},{"@type":"WebSite","@id":"https:\/\/griddb.net\/en\/#website","url":"https:\/\/griddb.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.net\/en\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/griddb.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/griddb.net\/en\/#organization","name":"Fixstars","url":"https:\/\/griddb.net\/en\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.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.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.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233","name":"griddb-admin","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/griddb.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:\/\/www.griddb.net\/en\/author\/griddb-admin\/"}]}},"_links":{"self":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46669","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/users\/41"}],"replies":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/comments?post=46669"}],"version-history":[{"count":1,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46669\/revisions"}],"predecessor-version":[{"id":51343,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46669\/revisions\/51343"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media\/27842"}],"wp:attachment":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46669"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46669"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}