Earth2 Country Statistics

pull/4/head
vaclavdekanovsky 2021-04-10 21:50:12 +02:00
parent e51fb5b2db
commit ef3ab87539
1 changed files with 379 additions and 0 deletions

View File

@ -0,0 +1,379 @@
{
"cells": [
{
"cell_type": "markdown",
"id": "chief-salon",
"metadata": {},
"source": [
"# Country prices and tiles sold\n",
"[Earth2.io](https://Earth2.io) is an emerging game that aims to create a virtual copy of the Earth's landscape (buildings will be wiped out) where players can build, interact and play. It's accessible as an in-browser experience and it plans to have augmented reality and virtual reality versions. Learn more about E2 in the [Earth2 Guide](https://earth2.guide). \n",
"\n",
"This notebook describes the unofficial API which allows downloading current prices and the number of tiles sold in each country in Earth 2.\n",
"\n",
"In the game, you can purchase a tile of approx. 10x. In the later stages, you will be able to build your desired things for fun or business. Every tile in the country costs the same. US West Coast price is equal to US East Coast price when you buy a new tile that is not yet claimed by other players. There is also a [marketplace](https://earth2.guide/marketplace) where you can offer your land for sale or buy from others. \n",
"\n",
"Some dependant territories falls under the international territory with the same price around the world. The United Arab Emirates were the latest country release in March-2021 and price differ in each of the 7 Emirates."
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "gentle-prisoner",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
"import json"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "controversial-focus",
"metadata": {},
"outputs": [],
"source": [
"url = \"https://app.earth2.io/graphql\"\n",
"data = {\"query\":\"{\\ngetAllTilePrices{\\ncurrent,\\nfinal,\\nvalue,\\ncountryCode,\\ncountryName,\\ncountryFlag,\\npercentIncrease,\\ntotalTilesSold\\n}\\n}\"}"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "thick-offense",
"metadata": {},
"outputs": [],
"source": [
"r = requests.post(url, data=data)\n",
"data = json.loads(r.content)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "received-anderson",
"metadata": {},
"outputs": [],
"source": [
"df = pd.DataFrame(data[\"data\"][\"getAllTilePrices\"])\n",
"df = df.rename(columns={\"current\":\"market_price\",\"final\":\"new_land_value\"})"
]
},
{
"cell_type": "markdown",
"id": "according-penalty",
"metadata": {},
"source": [
"Some dependant territories fall under the international territory."
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "descending-bulgarian",
"metadata": {},
"outputs": [],
"source": [
"# Change dependant territories to the international space\n",
"international_territory = [\"MP\", \"MO\", \"PM\", \"PR\", \"MF\", \"PF\", \"AE\", \"CW\", \"AW\", \"TF\", \"VI\", \"SX\", \"NC\", \"BL\", \"GF\",\n",
" \"BV\", \"UM\", \"CC\", \"CX\", \"GU\", \"TK\", \"AS\", \"WF\"]\n",
"df = df[~df[\"countryCode\"].isin(international_territory)]"
]
},
{
"cell_type": "markdown",
"id": "equipped-failing",
"metadata": {},
"source": [
"Some countries were not released yet and you cannot buy the land there. It has the initial price tag on 10 cents."
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "bound-bachelor",
"metadata": {},
"outputs": [],
"source": [
"# Remove the E$0.1 countries that were not released yet\n",
"not_active = [\"AE\",\"BQ\",\"IR\",\"YT\",\"GP\",\"AX\",\"RE\",\"MQ\",\"IQ\",\"IL\",\"SA\",\"SJ\"]\n",
"df = df[~df[\"countryCode\"].isin(not_active)]"
]
},
{
"cell_type": "markdown",
"id": "sustained-detail",
"metadata": {},
"source": [
"Let's sort the values by new_land_value. Some tiny countries like Vatican or Monaco were already sold out and you can buy them only on the [marketplace](https://earth2.guide/marketplace). The most expensive country is USA. "
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "interracial-sheep",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>market_price</th>\n",
" <th>new_land_value</th>\n",
" <th>value</th>\n",
" <th>countryCode</th>\n",
" <th>countryName</th>\n",
" <th>countryFlag</th>\n",
" <th>percentIncrease</th>\n",
" <th>totalTilesSold</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>98</th>\n",
" <td>0.457</td>\n",
" <td>0.457</td>\n",
" <td>0.457</td>\n",
" <td>NU</td>\n",
" <td>Niue</td>\n",
" <td>https://app-static.earth2.io/assets/flags/nu.png</td>\n",
" <td>357.00</td>\n",
" <td>152254</td>\n",
" </tr>\n",
" <tr>\n",
" <th>201</th>\n",
" <td>0.459</td>\n",
" <td>0.459</td>\n",
" <td>0.459</td>\n",
" <td>NF</td>\n",
" <td>Norfolk Island</td>\n",
" <td>https://app-static.earth2.io/assets/flags/nf.png</td>\n",
" <td>359.00</td>\n",
" <td>152951</td>\n",
" </tr>\n",
" <tr>\n",
" <th>177</th>\n",
" <td>0.600</td>\n",
" <td>0.462</td>\n",
" <td>0.600</td>\n",
" <td>MS</td>\n",
" <td>Montserrat</td>\n",
" <td>https://app-static.earth2.io/assets/flags/ms.png</td>\n",
" <td>500.00</td>\n",
" <td>153598</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>0.577</td>\n",
" <td>0.464</td>\n",
" <td>0.577</td>\n",
" <td>IO</td>\n",
" <td>British Indian Ocean Territory</td>\n",
" <td>https://app-static.earth2.io/assets/flags/io.png</td>\n",
" <td>476.92</td>\n",
" <td>153713</td>\n",
" </tr>\n",
" <tr>\n",
" <th>96</th>\n",
" <td>0.466</td>\n",
" <td>0.466</td>\n",
" <td>0.466</td>\n",
" <td>AI</td>\n",
" <td>Anguilla</td>\n",
" <td>https://app-static.earth2.io/assets/flags/ai.png</td>\n",
" <td>366.00</td>\n",
" <td>154366</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>51</th>\n",
" <td>130.000</td>\n",
" <td>11.570</td>\n",
" <td>130.000</td>\n",
" <td>VA</td>\n",
" <td>Holy See</td>\n",
" <td>https://app-static.earth2.io/assets/flags/va.png</td>\n",
" <td>129900.00</td>\n",
" <td>146</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>13.559</td>\n",
" <td>13.559</td>\n",
" <td>13.559</td>\n",
" <td>GB</td>\n",
" <td>United Kingdom</td>\n",
" <td>https://app-static.earth2.io/assets/flags/gb.png</td>\n",
" <td>13459.00</td>\n",
" <td>471420</td>\n",
" </tr>\n",
" <tr>\n",
" <th>120</th>\n",
" <td>16.229</td>\n",
" <td>16.229</td>\n",
" <td>16.229</td>\n",
" <td>IT</td>\n",
" <td>Italy</td>\n",
" <td>https://app-static.earth2.io/assets/flags/it.png</td>\n",
" <td>16129.00</td>\n",
" <td>509935</td>\n",
" </tr>\n",
" <tr>\n",
" <th>80</th>\n",
" <td>16.573</td>\n",
" <td>16.573</td>\n",
" <td>16.573</td>\n",
" <td>KR</td>\n",
" <td>South Korea</td>\n",
" <td>https://app-static.earth2.io/assets/flags/kr.png</td>\n",
" <td>16473.00</td>\n",
" <td>511812</td>\n",
" </tr>\n",
" <tr>\n",
" <th>243</th>\n",
" <td>54.924</td>\n",
" <td>54.924</td>\n",
" <td>54.924</td>\n",
" <td>US</td>\n",
" <td>United States of America</td>\n",
" <td>https://app-static.earth2.io/assets/flags/us.png</td>\n",
" <td>54824.00</td>\n",
" <td>600177</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>223 rows × 8 columns</p>\n",
"</div>"
],
"text/plain": [
" market_price new_land_value value countryCode \\\n",
"98 0.457 0.457 0.457 NU \n",
"201 0.459 0.459 0.459 NF \n",
"177 0.600 0.462 0.600 MS \n",
"42 0.577 0.464 0.577 IO \n",
"96 0.466 0.466 0.466 AI \n",
".. ... ... ... ... \n",
"51 130.000 11.570 130.000 VA \n",
"38 13.559 13.559 13.559 GB \n",
"120 16.229 16.229 16.229 IT \n",
"80 16.573 16.573 16.573 KR \n",
"243 54.924 54.924 54.924 US \n",
"\n",
" countryName \\\n",
"98 Niue \n",
"201 Norfolk Island \n",
"177 Montserrat \n",
"42 British Indian Ocean Territory \n",
"96 Anguilla \n",
".. ... \n",
"51 Holy See \n",
"38 United Kingdom \n",
"120 Italy \n",
"80 South Korea \n",
"243 United States of America \n",
"\n",
" countryFlag percentIncrease \\\n",
"98 https://app-static.earth2.io/assets/flags/nu.png 357.00 \n",
"201 https://app-static.earth2.io/assets/flags/nf.png 359.00 \n",
"177 https://app-static.earth2.io/assets/flags/ms.png 500.00 \n",
"42 https://app-static.earth2.io/assets/flags/io.png 476.92 \n",
"96 https://app-static.earth2.io/assets/flags/ai.png 366.00 \n",
".. ... ... \n",
"51 https://app-static.earth2.io/assets/flags/va.png 129900.00 \n",
"38 https://app-static.earth2.io/assets/flags/gb.png 13459.00 \n",
"120 https://app-static.earth2.io/assets/flags/it.png 16129.00 \n",
"80 https://app-static.earth2.io/assets/flags/kr.png 16473.00 \n",
"243 https://app-static.earth2.io/assets/flags/us.png 54824.00 \n",
"\n",
" totalTilesSold \n",
"98 152254 \n",
"201 152951 \n",
"177 153598 \n",
"42 153713 \n",
"96 154366 \n",
".. ... \n",
"51 146 \n",
"38 471420 \n",
"120 509935 \n",
"80 511812 \n",
"243 600177 \n",
"\n",
"[223 rows x 8 columns]"
]
},
"execution_count": 7,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.sort_values(by=\"new_land_value\")"
]
},
{
"cell_type": "markdown",
"id": "brave-bruce",
"metadata": {},
"source": [
"See the result of this calculation on the [Earth2 Country prices overview](https://earth2.guide/country_statistics/). "
]
},
{
"cell_type": "markdown",
"id": "coordinated-gibson",
"metadata": {},
"source": [
"**Beware** that you spend real money in this game. I cannot provide any financial advice, because I'm not a financial advisor. The game is **not** controlled by any agency. Don't spend the money you cannot lose. "
]
}
],
"metadata": {
"kernelspec": {
"display_name": "seo",
"language": "python",
"name": "seo"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}