Files
open_777/docs/convert_json.ipynb
T
2023-07-17 05:00:40 +02:00

385 lines
13 KiB
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
{
"cells": [
{
"cell_type": "code",
"execution_count": 37,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd\n",
"import json"
]
},
{
"cell_type": "code",
"execution_count": 41,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"./liber_777.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 42,
"metadata": {},
"outputs": [],
"source": [
"df = df.transpose()"
]
},
{
"cell_type": "code",
"execution_count": 43,
"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>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>...</th>\n",
" <th>25</th>\n",
" <th>26</th>\n",
" <th>27</th>\n",
" <th>28</th>\n",
" <th>29</th>\n",
" <th>30</th>\n",
" <th>31</th>\n",
" <th>32</th>\n",
" <th>33</th>\n",
" <th>34</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>Category</th>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" <td>3</td>\n",
" <td>4</td>\n",
" <td>5</td>\n",
" <td>6</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" <td>9</td>\n",
" <td>...</td>\n",
" <td>25</td>\n",
" <td>26</td>\n",
" <td>27</td>\n",
" <td>28</td>\n",
" <td>29</td>\n",
" <td>30</td>\n",
" <td>31</td>\n",
" <td>32</td>\n",
" <td>32 bis</td>\n",
" <td>31 bis</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2 - Hebrew Names</th>\n",
" <td>Ain (אין) - Ain Soph (אין סוף) - Ain Soph Aur ...</td>\n",
" <td>(כתר) Kether</td>\n",
" <td>Chokmah ()</td>\n",
" <td>(בינה) Binah</td>\n",
" <td>Chesed ()</td>\n",
" <td>(גבורה) Geburah</td>\n",
" <td>Tiphareth ()</td>\n",
" <td>(נצח) Netzach</td>\n",
" <td>Hod ()</td>\n",
" <td>(יסוד) Yesod</td>\n",
" <td>...</td>\n",
" <td>(סמך) Samekh</td>\n",
" <td>Ayin ()</td>\n",
" <td>(פה) Pé</td>\n",
" <td>(צדי) Tzaddi</td>\n",
" <td>(קוף) Qoph</td>\n",
" <td>(ריש) Resh</td>\n",
" <td>(שין) Shin</td>\n",
" <td>(תו) Tau</td>\n",
" <td>(תו) Tau</td>\n",
" <td>(שין) Shin</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3 - English of II</th>\n",
" <td>Limitless LVX - No Limit - Nothing</td>\n",
" <td>Crown</td>\n",
" <td>Wisdom</td>\n",
" <td>Understanding</td>\n",
" <td>Mercy</td>\n",
" <td>Strength</td>\n",
" <td>Beauty</td>\n",
" <td>Victory</td>\n",
" <td>Splendour</td>\n",
" <td>Foundation</td>\n",
" <td>...</td>\n",
" <td>Prop</td>\n",
" <td>Eye</td>\n",
" <td>Mouth</td>\n",
" <td>Fish-hook</td>\n",
" <td>Back of head</td>\n",
" <td>Head</td>\n",
" <td>Tooth</td>\n",
" <td>Tau (as Egyptian)</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10 - Mystic Numbers of the Sephiroth</th>\n",
" <td>0</td>\n",
" <td>1</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" <td>10</td>\n",
" <td>15</td>\n",
" <td>21</td>\n",
" <td>28</td>\n",
" <td>36</td>\n",
" <td>45</td>\n",
" <td>...</td>\n",
" <td>325</td>\n",
" <td>351</td>\n",
" <td>378</td>\n",
" <td>406</td>\n",
" <td>435</td>\n",
" <td>465</td>\n",
" <td>496</td>\n",
" <td>528</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11 - Elements &amp; Rulers</th>\n",
" <td>...</td>\n",
" <td>Root of 🜁</td>\n",
" <td>Root of 🜁</td>\n",
" <td>Root of 🜁</td>\n",
" <td>🜄</td>\n",
" <td>🜂</td>\n",
" <td>🜁</td>\n",
" <td>🜂</td>\n",
" <td>🜄</td>\n",
" <td>🜁</td>\n",
" <td>...</td>\n",
" <td>Sun - 🜂 - Jupiter</td>\n",
" <td>Venus - 🜃 - Moon</td>\n",
" <td>...</td>\n",
" <td>Saturn - 🜁 - Mercury</td>\n",
" <td>Mars - 🜄</td>\n",
" <td>...</td>\n",
" <td>Hot &amp; Dry 🜂</td>\n",
" <td>...</td>\n",
" <td>Cold &amp; Dry 🜃</td>\n",
" <td>...</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>5 rows × 35 columns</p>\n",
"</div>"
],
"text/plain": [
" 0 \\\n",
"Category 0 \n",
"2 - Hebrew Names Ain (אין) - Ain Soph (אין סוף) - Ain Soph Aur ... \n",
"3 - English of II Limitless LVX - No Limit - Nothing \n",
"10 - Mystic Numbers of the Sephiroth 0 \n",
"11 - Elements & Rulers ... \n",
"\n",
" 1 2 \\\n",
"Category 1 2 \n",
"2 - Hebrew Names (כתר) Kether Chokmah () \n",
"3 - English of II Crown Wisdom \n",
"10 - Mystic Numbers of the Sephiroth 1 3 \n",
"11 - Elements & Rulers Root of 🜁 Root of 🜁 \n",
"\n",
" 3 4 \\\n",
"Category 3 4 \n",
"2 - Hebrew Names (בינה) Binah Chesed () \n",
"3 - English of II Understanding Mercy \n",
"10 - Mystic Numbers of the Sephiroth 6 10 \n",
"11 - Elements & Rulers Root of 🜁 🜄 \n",
"\n",
" 5 6 \\\n",
"Category 5 6 \n",
"2 - Hebrew Names (גבורה) Geburah Tiphareth () \n",
"3 - English of II Strength Beauty \n",
"10 - Mystic Numbers of the Sephiroth 15 21 \n",
"11 - Elements & Rulers 🜂 🜁 \n",
"\n",
" 7 8 9 \\\n",
"Category 7 8 9 \n",
"2 - Hebrew Names (נצח) Netzach Hod () (יסוד) Yesod \n",
"3 - English of II Victory Splendour Foundation \n",
"10 - Mystic Numbers of the Sephiroth 28 36 45 \n",
"11 - Elements & Rulers 🜂 🜄 🜁 \n",
"\n",
" ... 25 \\\n",
"Category ... 25 \n",
"2 - Hebrew Names ... (סמך) Samekh \n",
"3 - English of II ... Prop \n",
"10 - Mystic Numbers of the Sephiroth ... 325 \n",
"11 - Elements & Rulers ... Sun - 🜂 - Jupiter \n",
"\n",
" 26 27 \\\n",
"Category 26 27 \n",
"2 - Hebrew Names Ayin () (פה) Pé \n",
"3 - English of II Eye Mouth \n",
"10 - Mystic Numbers of the Sephiroth 351 378 \n",
"11 - Elements & Rulers Venus - 🜃 - Moon ... \n",
"\n",
" 28 29 \\\n",
"Category 28 29 \n",
"2 - Hebrew Names (צדי) Tzaddi (קוף) Qoph \n",
"3 - English of II Fish-hook Back of head \n",
"10 - Mystic Numbers of the Sephiroth 406 435 \n",
"11 - Elements & Rulers Saturn - 🜁 - Mercury Mars - 🜄 \n",
"\n",
" 30 31 \\\n",
"Category 30 31 \n",
"2 - Hebrew Names (ריש) Resh (שין) Shin \n",
"3 - English of II Head Tooth \n",
"10 - Mystic Numbers of the Sephiroth 465 496 \n",
"11 - Elements & Rulers ... Hot & Dry 🜂 \n",
"\n",
" 32 33 \\\n",
"Category 32 32 bis \n",
"2 - Hebrew Names (תו) Tau (תו) Tau \n",
"3 - English of II Tau (as Egyptian) ... \n",
"10 - Mystic Numbers of the Sephiroth 528 ... \n",
"11 - Elements & Rulers ... Cold & Dry 🜃 \n",
"\n",
" 34 \n",
"Category 31 bis \n",
"2 - Hebrew Names (שין) Shin \n",
"3 - English of II ... \n",
"10 - Mystic Numbers of the Sephiroth ... \n",
"11 - Elements & Rulers ... \n",
"\n",
"[5 rows x 35 columns]"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 44,
"metadata": {},
"outputs": [],
"source": [
"df = df.reset_index()"
]
},
{
"cell_type": "code",
"execution_count": 45,
"metadata": {},
"outputs": [],
"source": [
"df = df.iloc[1:]"
]
},
{
"cell_type": "code",
"execution_count": 46,
"metadata": {},
"outputs": [],
"source": [
"json_string = df.to_json(orient='records', force_ascii=False)\n",
"o = json.loads(json_string)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": []
},
{
"cell_type": "code",
"execution_count": 47,
"metadata": {},
"outputs": [],
"source": [
"json_data = json.dumps(o, ensure_ascii=False).encode('utf-8').decode('unicode_escape')\n",
"\n",
"# Specify the JavaScript file path\n",
"js_file_path = '../src/liber_777.js'\n",
"\n",
"import json\n",
"with open(js_file_path, 'w', encoding='utf8') as f:\n",
"\tf.write('export const Liber777 = ')\n",
"\tjson.dump(o, f, ensure_ascii=False)\n",
"\tf.write(';')"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "drlnd",
"language": "python",
"name": "python3"
},
"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.6"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}