{"id":46727,"date":"2022-09-02T00:00:00","date_gmt":"2022-09-02T07:00:00","guid":{"rendered":"https:\/\/griddb-linux-hte8hndjf8cka8ht.westus-01.azurewebsites.net\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/"},"modified":"2025-11-13T12:56:17","modified_gmt":"2025-11-13T20:56:17","slug":"using-griddb-to-analyze-gdp-of-different-countries","status":"publish","type":"post","link":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/","title":{"rendered":"Using GridDB to Analyze GDP of Different Countries"},"content":{"rendered":"<p><a href=\"https:\/\/www.worldometers.info\/gdp\/what-is-gdp\/\">GDP<\/a>, which stands for &#8220;Gross Domestic Product,&#8221; is the total monetary value of all final goods and services produced (and sold on the market) within a country over a given period (typically one year). It is used as a metric for any country&#8217;s economic growth.<\/p>\n<p>We will use GridDB to analyze the economic status of various countries. GridDB is a highly scalable and optimized in-memory No SQL database that allows parallel processing for higher performance and efficiency, especially for time-series databases. We will be using GridDB&#8217;s node js client, which allows us to connect GridDB to node js and import or export data in real-time. Furthermore, we will use the DanfoJS library to work with data frames for data analysis.<\/p>\n<p>The dataset, which is in csv format, was obtained from <a href=\"https:\/\/www.kaggle.com\/datasets\/alejopaullier\/-gdp-by-country-1999-2022\">Kaggle<\/a>. We will see what the data represents later in the Data Analysis section.<\/p>\n<p><a href=\"https:\/\/github.com\/griddbnet\/Blogs\/tree\/analyzing-gdp-countries\">full source code and dataset here<\/a><\/p>\n<h2>Exporting Dataset into GridDB<\/h2>\n<p>To begin, we must initialize the GridDB node modules griddb node, danfojs-node, and csv-parser. Griddb node starts the node so we can work on GridDB, Danfojs-node is initialized as a variable, df, which is used in data analysis, and csv-parser will upload our dataset into GridDB by reading the csv file, which is as follows:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">var griddb = require('griddb_node');\n\nconst dfd = require(\"danfojs-node\")\nconst csv = require('csv-parser');\nconst fs = require('fs');\nfs.createReadStream('.\/Dataset\/GDP by Country 1999-2022.csv')\n  .pipe(csv())\n  .on('data', (row) => {\n    lst.push(row);\n    console.log(lst);\n  })<\/code><\/pre>\n<\/div>\n<p>Following variable initialization, we will generate the GridDB container to create the database schema. In the container, we have to define the data types of columns in our dataset. We can then use the container later to access the stored data, completing our data insertion into the GridDB.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">const conInfo = new griddb.ContainerInfo({\n    'name': \"gdpanalysis\",\n    'columnInfoList': [\n      [\"name\", griddb.Type.STRING],\n      [\"Country\", griddb.Type.STRING],\n        [\"1999\", griddb.Type.DOUBLE],\n        [\"2000\", griddb.Type.DOUBLE],\n        [\"2001\", griddb.Type.DOUBLE],\n        [\"2002\", griddb.Type.DOUBLE],\n        [\"2003\", griddb.Type.DOUBLE],\n        [\"2004\", griddb.Type.DOUBLE],\n        [\"2005\", griddb.Type.DOUBLE],\n        [\"2006\", griddb.Type.DOUBLE],\n        [\"2007\", griddb.Type.DOUBLE],\n        [\"2008\", griddb.Type.DOUBLE],\n        [\"2009\", griddb.Type.DOUBLE],\n        [\"2010\", griddb.Type.DOUBLE],\n        [\"2011\", griddb.Type.DOUBLE],\n        [\"2012\", griddb.Type.DOUBLE],\n        [\"2013\", griddb.Type.DOUBLE],\n        [\"2014\", griddb.Type.DOUBLE],\n        [\"2015\", griddb.Type.DOUBLE],\n        [\"2016\", griddb.Type.DOUBLE],\n        [\"2017\", griddb.Type.DOUBLE],\n        [\"2018\", griddb.Type.DOUBLE],\n        [\"2019\", griddb.Type.DOUBLE],\n        [\"2020\", griddb.Type.DOUBLE],\n        [\"2021\", griddb.Type.DOUBLE]\n    ],\n    'type': griddb.ContainerType.COLLECTION, 'rowKey': true\n});\n\n\/\/\/ Inserting Data into GridDB\n\n    for(let i=0;i&lt;lst.length;i++){\n\n    store.putContainer(conInfo, false)\n        .then(cont => {\n            container = cont;\n            return container.createIndex({ 'columnName': 'name', 'indexType': griddb.IndexType.DEFAULT });\n        })\n        .then(() => {\n            idx++;\n            container.setAutoCommit(false);\n            return container.put([String(idx), lst[i]['Country'],lst[i][\"1999\"],lst[i][\"2000\"],lst[i][\"2001\"],lst[i][\"2002\"],lst[i][\"2003\"],lst[i][\"2004\"],lst[i][\"2005\"],lst[i][\"2006\"],lst[i][\"2007\"],lst[i][\"2008\"],lst[i][\"2009\"],lst[i][\"2010\"],lst[i][\"2011\"],lst[i][\"2012\"],lst[i][\"2013\"],lst[i][\"2014\"],lst[i][\"2015\"],lst[i][\"2016\"],lst[i][\"2017\"],lst[i][\"2018\"],lst[i][\"2019\"],lst[i][\"2020\"],lst[i][\"2021\"]]);\n        })\n        .then(() => {\n            return container.commit();\n        })      \n        .catch(err => {\n            if (err.constructor.name == \"GSException\") {\n                for (var i = 0; i &lt; err.getErrorStackSize(); i++) {\n                    console.log(\"[\", i, \"]\");\n                    console.log(err.getErrorCode(i));\n                    console.log(err.getMessage(i));\n                }\n            } else {\n                console.log(err);\n            }\n        });    \n    }<\/code><\/pre>\n<\/div>\n<h2>Importing Dataset from GridDB<\/h2>\n<p>Since we&#8217;ve already saved all of our data in the container, all we have to do now is retrieve it using TQL, GridDB&#8217;s SQL-like query language. So, to begin, we will construct a container for the retrieved data, named obtained_data. The next step is to extract the rows in the column order, named query, and save them in a data frame, named df, for data visualization and analysis, completing our data import.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\"># Get the containers\nobtained_data = gridstore.get_container(\"gdpanalysis\")\n    \n# Fetch all rows - language_tag_container\nquery = obtained_data.query(\"select *\")\n\n# Creating Data Frame variable\nlet df = await dfd.readCSV(\".\/out.csv\")<\/code><\/pre>\n<\/div>\n<h2>Data Analysis<\/h2>\n<p>To begin our data analysis, we will examine the columns of our dataset and what they represent, as well as the total number of rows and columns in our dataset:<\/p>\n<ul>\n<li>Country : Names of the countries in the dataset.<\/li>\n<li>1999 : GDP of the specific country in the year 1990.<\/li>\n<li>\n<p>2000 : GDP of the specific country in the year 2000.<\/p>\n<p>.<\/p>\n<p>.<\/p>\n<p>.<\/p>\n<\/li>\n<li>\n<p>2021 : GDP of the specific country in the year 2021.<\/p>\n<\/li>\n<\/ul>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">console.log(df.shape)\n\n\/\/  Output\n\/\/ [ 180, 24 ]<\/code><\/pre>\n<\/div>\n<p>We have 180 rows and 24 columns, so we have the GDP of 180 different countries from 1999 to 2021.<\/p>\n<p>We will check if we have null values in our dataset:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">for (let column_name in p1_df.columns){\n    column = p1_df[column_name];\n    # Get the count of Zeros in column \n    count = (column == '0').sum();\n    console.log('Count of zeros in column ', column_name, ' is : ', count)\n}\n\/\/ Output \n\/\/ Count of zeroes in column  Country  is :  0\n\/\/ Count of zeroes in column  1999  is :  2\n\/\/ Count of zeroes in column  2000  is :  1\n\/\/ Count of zeroes in column  2001  is :  1\n\/\/ Count of zeroes in column  2002  is :  0\n\/\/ Count of zeroes in column  2003  is :  0\n\/\/ Count of zeroes in column  2004  is :  0\n\/\/ Count of zeroes in column  2005  is :  0\n\/\/ Count of zeroes in column  2006  is :  0\n\/\/ Count of zeroes in column  2007  is :  0\n\/\/ Count of zeroes in column  2008  is :  0\n\/\/ Count of zeroes in column  2009  is :  1\n\/\/ Count of zeroes in column  2010  is :  1\n\/\/ Count of zeroes in column  2011  is :  1\n\/\/ Count of zeroes in column  2012  is :  1\n\/\/ Count of zeroes in column  2013  is :  1\n\/\/ Count of zeroes in column  2014  is :  13\n\/\/ Count of zeroes in column  2015  is :  14\n\/\/ Count of zeroes in column  2016  is :  14\n\/\/ Count of zeroes in column  2017  is :  14\n\/\/ Count of zeroes in column  2018  is :  14\n\/\/ Count of zeroes in column  2019  is :  14\n\/\/ Count of zeroes in column  2020  is :  15\n\/\/ Count of zeroes in column  2021  is :  16<\/code><\/pre>\n<\/div>\n<p>We have all our GDP values in object data type; thus, we will change the data types of the dataset into float so that we can replace the zero values with GDP median value for each country as GDP can never be zero, which is as shown below:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">for (let column_name in p1_df.columns){\n\n  if(column_name == 'Country'){\n  \n  continue;\n}\nelse{\n\n  df = df.asType(column_name, \"float64\")\n}\n\nfor (let column_name in p1_df.columns){\n\n  df[column_name]=df[column_name].replace(0, df[column_name].median())\n\n}<\/code><\/pre>\n<\/div>\n<p>Now that our data is clean, we can proceed with the analysis.<\/p>\n<p>To begin, we will plot a line chart to see the global GDP trend, calculated by combining the GDP of all 180 countries into a single line chart as shown below:<\/p>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/08\/LineChart.png\"><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/08\/LineChart.png\" alt=\"\" width=\"465\" height=\"306\" class=\"aligncenter size-full wp-image-28713\" srcset=\"\/wp-content\/uploads\/2022\/08\/LineChart.png 465w, \/wp-content\/uploads\/2022\/08\/LineChart-300x197.png 300w\" sizes=\"(max-width: 465px) 100vw, 465px\" \/><\/a><\/p>\n<p>Secondly, we will compare the summary statistics to see each country&#8217;s progress from 1999 to 2021.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">df.loc({columns:['2016', '2017', '2018', '2019', '2020', '2021']}).describe().round(2).print()\n\n\n\n\/\/ Output\n\/\/ \u2554\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2564\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2557\n\/\/ \u2551            \u2502 2016              \u2502 2017              \u2502 2018              \u2502 2019              \u2502 2020              \u2502 2021              \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 count      \u2502 180               \u2502 180               \u2502 180               \u2502 180               \u2502 180               \u2502 180               \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 mean       \u2502 111.26            \u2502 112.58            \u2502 119.30            \u2502 126.77            \u2502 119.70            \u2502 127.74            \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 std        \u2502 179.68            \u2502 176.69            \u2502 186.00            \u2502 196.63            \u2502 186.40            \u2502 199.65            \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 min        \u2502 0.16              \u2502 0.17              \u2502 0.17              \u2502 0.18              \u2502 0.23              \u2502 0.25              \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 median     \u2502 2657.38           \u2502 2868.33           \u2502 2978.95           \u2502 3207.04           \u2502 2689.55           \u2502 2899.29           \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 max        \u2502 19555.87          \u2502 20493.25          \u2502 21404.19          \u2502 22294.11          \u2502 22939.58          \u2502 24796.08          \u2551\n\/\/ \u255f\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u253c\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2562\n\/\/ \u2551 variance   \u2502 32286.52          \u2502 31220.07          \u2502 34596.34          \u2502 38661.75          \u2502 34743.69          \u2502 39862.26          \u2551\n\/\/ \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2567\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d<\/code><\/pre>\n<\/div>\n<p>The median and variance values give the idea that most countries in the world have suffered economically as even the median is quite low and the variance is greater, determining the difference between the first and the third world countries. This suffering occurred because of Covid-19 from 2018 to 2020, which struck badly on every country and disturbed the whole economy. But after the Covid-19 cases went down, the countries started to recover, as shown in the line chart above. On the other hand, even after all this suffering, let&#8217;s see which country has the maximum GDP from 2016 to 2021 in the last six years.<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">console.log(df.loc(df[df['2016'].max()]))\nconsole.log(df.loc(df[df['2017'].max()]))\nconsole.log(df.loc(df[df['2018'].max()]))\nconsole.log(df.loc(df[df['2019'].max()]))\nconsole.log(df.loc(df[df['2020'].max()]))\nconsole.log(df.loc(df[df['2021'].max()]))\n\n\/\/ Output\n\/\/ United States\n\/\/ United States\n\/\/ United States\n\/\/ United States\n\/\/ United States\n\/\/ United States<\/code><\/pre>\n<\/div>\n<p>It is no surprise that the United States has topped the GDP chart, but China isn&#8217;t far behind. China is also on the rise in competing with the United States, and the gap is not as large as it appears in the bar graph below:<\/p>\n<div class=\"clipboard\">\n<pre><code class=\"language-javascript\">## Distribution of Column Values\nconst { Plotly } = require('node-kernel');\nlet cols = df.columns\nfor(let i = 0; i &lt; cols.length; i++)\n{\n    let data = [{\n        x: cols[i],\n        y: df[cols[i]].values,\n        type: 'bar'}];\n    let layout = {\n        height: 400,\n        width: 700,\n        title: 'GDP for United States of America and China (2016 - 2021)' +cols[i],\n        xaxis: {title: cols[i]}};\n    \/\/ There is no HTML element named `myDiv`, hence the plot is displayed below.\n    Plotly.newPlot('myDiv', data, layout);\n}\ndf.plot(\"plot_div\").bar()<\/code><\/pre>\n<\/div>\n<p><a href=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/08\/Barplot.png\"><img decoding=\"async\" src=\"https:\/\/griddb.net\/wp-content\/uploads\/2022\/08\/Barplot.png\" alt=\"\" width=\"481\" height=\"306\" class=\"aligncenter size-full wp-image-28715\" srcset=\"\/wp-content\/uploads\/2022\/08\/Barplot.png 481w, \/wp-content\/uploads\/2022\/08\/Barplot-300x191.png 300w\" sizes=\"(max-width: 481px) 100vw, 481px\" \/><\/a><\/p>\n<h2>Conclusion<\/h2>\n<p>While some countries started to recover from the loss of Covid-19 in 2021 as Covid-19 restrictions got held off, the Russian invasion of Ukraine again struck the world economy. It gave rise to inflation as petroleum prices shot through the roof, and these fluctuations would now cause the GDP to lower in 2022 when the GDP of each country is calculated when 2022 is over.<\/p>\n<p>While with the data that we had, we saw that certain third world countries are trying to become a part of the first world while the first world countries are competing with each other for the superpower position.<\/p>\n<p>Lastly, GridDB was used for all this data analysis because it allowed for quick access and efficient reading, writing, and storing of data.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>GDP, which stands for &#8220;Gross Domestic Product,&#8221; is the total monetary value of all final goods and services produced (and sold on the market) within a country over a given period (typically one year). It is used as a metric for any country&#8217;s economic growth. We will use GridDB to analyze the economic status of [&hellip;]<\/p>\n","protected":false},"author":41,"featured_media":28801,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[121],"tags":[],"class_list":["post-46727","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>Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT<\/title>\n<meta name=\"description\" content=\"GDP, which stands for &quot;Gross Domestic Product,&quot; is the total monetary value of all final goods and services produced (and sold on the market) within a\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT\" \/>\n<meta property=\"og:description\" content=\"GDP, which stands for &quot;Gross Domestic Product,&quot; is the total monetary value of all final goods and services produced (and sold on the market) within a\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\" \/>\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=\"2022-09-02T07:00:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-11-13T20:56:17+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.griddb.net\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1920\" \/>\n\t<meta property=\"og:image:height\" content=\"1278\" \/>\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:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\"},\"author\":{\"name\":\"griddb-admin\",\"@id\":\"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233\"},\"headline\":\"Using GridDB to Analyze GDP of Different Countries\",\"datePublished\":\"2022-09-02T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:56:17+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\"},\"wordCount\":814,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\/\/griddb.net\/en\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg\",\"articleSection\":[\"Blog\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\",\"url\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\",\"name\":\"Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT\",\"isPartOf\":{\"@id\":\"https:\/\/griddb.net\/en\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage\"},\"thumbnailUrl\":\"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg\",\"datePublished\":\"2022-09-02T07:00:00+00:00\",\"dateModified\":\"2025-11-13T20:56:17+00:00\",\"description\":\"GDP, which stands for \\\"Gross Domestic Product,\\\" is the total monetary value of all final goods and services produced (and sold on the market) within a\",\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage\",\"url\":\"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg\",\"contentUrl\":\"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg\",\"width\":1920,\"height\":1278},{\"@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":"Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT","description":"GDP, which stands for \"Gross Domestic Product,\" is the total monetary value of all final goods and services produced (and sold on the market) within a","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:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/","og_locale":"en_US","og_type":"article","og_title":"Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT","og_description":"GDP, which stands for \"Gross Domestic Product,\" is the total monetary value of all final goods and services produced (and sold on the market) within a","og_url":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/","og_site_name":"GridDB: Open Source Time Series Database for IoT","article_publisher":"https:\/\/www.facebook.com\/griddbcommunity\/","article_published_time":"2022-09-02T07:00:00+00:00","article_modified_time":"2025-11-13T20:56:17+00:00","og_image":[{"width":1920,"height":1278,"url":"https:\/\/www.griddb.net\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.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:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#article","isPartOf":{"@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/"},"author":{"name":"griddb-admin","@id":"https:\/\/griddb.net\/en\/#\/schema\/person\/4fe914ca9576878e82f5e8dd3ba52233"},"headline":"Using GridDB to Analyze GDP of Different Countries","datePublished":"2022-09-02T07:00:00+00:00","dateModified":"2025-11-13T20:56:17+00:00","mainEntityOfPage":{"@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/"},"wordCount":814,"commentCount":0,"publisher":{"@id":"https:\/\/griddb.net\/en\/#organization"},"image":{"@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg","articleSection":["Blog"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/","url":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/","name":"Using GridDB to Analyze GDP of Different Countries | GridDB: Open Source Time Series Database for IoT","isPartOf":{"@id":"https:\/\/griddb.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage"},"image":{"@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage"},"thumbnailUrl":"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg","datePublished":"2022-09-02T07:00:00+00:00","dateModified":"2025-11-13T20:56:17+00:00","description":"GDP, which stands for \"Gross Domestic Product,\" is the total monetary value of all final goods and services produced (and sold on the market) within a","inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.griddb.net\/en\/blog\/using-griddb-to-analyze-gdp-of-different-countries\/#primaryimage","url":"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg","contentUrl":"\/wp-content\/uploads\/2022\/08\/money-money-money_1920x1278.jpg","width":1920,"height":1278},{"@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\/46727","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=46727"}],"version-history":[{"count":1,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46727\/revisions"}],"predecessor-version":[{"id":51399,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/posts\/46727\/revisions\/51399"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media\/28801"}],"wp:attachment":[{"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/media?parent=46727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/categories?post=46727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.griddb.net\/en\/wp-json\/wp\/v2\/tags?post=46727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}