Files
open_777/docs/convert_json.ipynb
T
2023-07-16 14:41:02 +02:00

377 lines
14 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": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 71,
"metadata": {},
"outputs": [],
"source": [
"df = pd.read_csv(\"./liver_777.csv\")"
]
},
{
"cell_type": "code",
"execution_count": 72,
"metadata": {},
"outputs": [],
"source": [
"df = df.transpose()"
]
},
{
"cell_type": "code",
"execution_count": 73,
"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>II - Hebrew Names of Numbers and Letters</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>III - 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>X - 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>XI - 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",
"II - Hebrew Names of Numbers and Letters Ain (אין) - Ain Soph (אין סוף) - Ain Soph Aur ... \n",
"III - English of II Limitless LVX - No Limit - Nothing \n",
"X - Mystic Numbers of the Sephiroth 0 \n",
"XI - Elements & Rulers ... \n",
"\n",
" 1 2 \\\n",
"Category 1 2 \n",
"II - Hebrew Names of Numbers and Letters (כתר) Kether Chokmah () \n",
"III - English of II Crown Wisdom \n",
"X - Mystic Numbers of the Sephiroth 1 3 \n",
"XI - Elements & Rulers Root of 🜁 Root of 🜁 \n",
"\n",
" 3 4 \\\n",
"Category 3 4 \n",
"II - Hebrew Names of Numbers and Letters (בינה) Binah Chesed () \n",
"III - English of II Understanding Mercy \n",
"X - Mystic Numbers of the Sephiroth 6 10 \n",
"XI - Elements & Rulers Root of 🜁 🜄 \n",
"\n",
" 5 6 \\\n",
"Category 5 6 \n",
"II - Hebrew Names of Numbers and Letters (גבורה) Geburah Tiphareth () \n",
"III - English of II Strength Beauty \n",
"X - Mystic Numbers of the Sephiroth 15 21 \n",
"XI - Elements & Rulers 🜂 🜁 \n",
"\n",
" 7 8 \\\n",
"Category 7 8 \n",
"II - Hebrew Names of Numbers and Letters (נצח) Netzach Hod () \n",
"III - English of II Victory Splendour \n",
"X - Mystic Numbers of the Sephiroth 28 36 \n",
"XI - Elements & Rulers 🜂 🜄 \n",
"\n",
" 9 ... \\\n",
"Category 9 ... \n",
"II - Hebrew Names of Numbers and Letters (יסוד) Yesod ... \n",
"III - English of II Foundation ... \n",
"X - Mystic Numbers of the Sephiroth 45 ... \n",
"XI - Elements & Rulers 🜁 ... \n",
"\n",
" 25 26 \\\n",
"Category 25 26 \n",
"II - Hebrew Names of Numbers and Letters (סמך) Samekh Ayin () \n",
"III - English of II Prop Eye \n",
"X - Mystic Numbers of the Sephiroth 325 351 \n",
"XI - Elements & Rulers Sun - 🜂 - Jupiter Venus - 🜃 - Moon \n",
"\n",
" 27 28 \\\n",
"Category 27 28 \n",
"II - Hebrew Names of Numbers and Letters (פה) Pé (צדי) Tzaddi \n",
"III - English of II Mouth Fish-hook \n",
"X - Mystic Numbers of the Sephiroth 378 406 \n",
"XI - Elements & Rulers ... Saturn - 🜁 - Mercury \n",
"\n",
" 29 30 \\\n",
"Category 29 30 \n",
"II - Hebrew Names of Numbers and Letters (קוף) Qoph (ריש) Resh \n",
"III - English of II Back of head Head \n",
"X - Mystic Numbers of the Sephiroth 435 465 \n",
"XI - Elements & Rulers Mars - 🜄 ... \n",
"\n",
" 31 32 \\\n",
"Category 31 32 \n",
"II - Hebrew Names of Numbers and Letters (שין) Shin (תו) Tau \n",
"III - English of II Tooth Tau (as Egyptian) \n",
"X - Mystic Numbers of the Sephiroth 496 528 \n",
"XI - Elements & Rulers Hot & Dry 🜂 ... \n",
"\n",
" 33 34 \n",
"Category 32 bis 31 bis \n",
"II - Hebrew Names of Numbers and Letters (תו) Tau (שין) Shin \n",
"III - English of II ... ... \n",
"X - Mystic Numbers of the Sephiroth ... ... \n",
"XI - Elements & Rulers Cold & Dry 🜃 ... \n",
"\n",
"[5 rows x 35 columns]"
]
},
"execution_count": 73,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.head()"
]
},
{
"cell_type": "code",
"execution_count": 74,
"metadata": {},
"outputs": [],
"source": [
"df = df.reset_index()"
]
},
{
"cell_type": "code",
"execution_count": 75,
"metadata": {},
"outputs": [],
"source": [
"df = df.iloc[1:]"
]
},
{
"cell_type": "code",
"execution_count": 76,
"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": 77,
"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": []
}
],
"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.6.9"
},
"orig_nbformat": 4
},
"nbformat": 4,
"nbformat_minor": 2
}