-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from Mya-Mya/DEV01
Dev01
- Loading branch information
Showing
9 changed files
with
1,168 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,221 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 1, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"from pandas import DataFrame\n", | ||
"import sys\n", | ||
"import os\n", | ||
"sys.path.insert(0, os.path.abspath(\"../\"))\n", | ||
"import yagamee" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 2, | ||
"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>original</th>\n", | ||
" <th>小数点2桁</th>\n", | ||
" <th>小数点5桁</th>\n", | ||
" <th>有効数字2桁</th>\n", | ||
" <th>有効数字5桁</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <th>0</th>\n", | ||
" <td>1.234000</td>\n", | ||
" <td>1.234000</td>\n", | ||
" <td>1.234000</td>\n", | ||
" <td>1.234000</td>\n", | ||
" <td>1.234000</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>1</th>\n", | ||
" <td>1234.000000</td>\n", | ||
" <td>1234.000000</td>\n", | ||
" <td>1234.000000</td>\n", | ||
" <td>1234.000000</td>\n", | ||
" <td>1234.000000</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <th>2</th>\n", | ||
" <td>0.000012</td>\n", | ||
" <td>0.000012</td>\n", | ||
" <td>0.000012</td>\n", | ||
" <td>0.000012</td>\n", | ||
" <td>0.000012</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n", | ||
"</div>" | ||
], | ||
"text/plain": [ | ||
" original 小数点2桁 小数点5桁 有効数字2桁 有効数字5桁\n", | ||
"0 1.234000 1.234000 1.234000 1.234000 1.234000\n", | ||
"1 1234.000000 1234.000000 1234.000000 1234.000000 1234.000000\n", | ||
"2 0.000012 0.000012 0.000012 0.000012 0.000012" | ||
] | ||
}, | ||
"execution_count": 2, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"row = [1.234, 1234, 0.00001234]\n", | ||
"df = DataFrame(\n", | ||
" {col: row for col in [\"original\", \"小数点2桁\", \"小数点5桁\", \"有効数字2桁\", \"有効数字5桁\"]}\n", | ||
")\n", | ||
"df\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 3, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"sigfig_notation=\" E2E5G2G5\"" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"data": { | ||
"text/html": [ | ||
"<style type=\"text/css\">\n", | ||
"</style>\n", | ||
"<table id=\"T_68e93\">\n", | ||
" <thead>\n", | ||
" <tr>\n", | ||
" <th id=\"T_68e93_level0_col0\" class=\"col_heading level0 col0\" >original</th>\n", | ||
" <th id=\"T_68e93_level0_col1\" class=\"col_heading level0 col1\" >小数点2桁</th>\n", | ||
" <th id=\"T_68e93_level0_col2\" class=\"col_heading level0 col2\" >小数点5桁</th>\n", | ||
" <th id=\"T_68e93_level0_col3\" class=\"col_heading level0 col3\" >有効数字2桁</th>\n", | ||
" <th id=\"T_68e93_level0_col4\" class=\"col_heading level0 col4\" >有効数字5桁</th>\n", | ||
" </tr>\n", | ||
" </thead>\n", | ||
" <tbody>\n", | ||
" <tr>\n", | ||
" <td id=\"T_68e93_row0_col0\" class=\"data row0 col0\" >1.234000</td>\n", | ||
" <td id=\"T_68e93_row0_col1\" class=\"data row0 col1\" >1.23</td>\n", | ||
" <td id=\"T_68e93_row0_col2\" class=\"data row0 col2\" >1.23400</td>\n", | ||
" <td id=\"T_68e93_row0_col3\" class=\"data row0 col3\" >1.2</td>\n", | ||
" <td id=\"T_68e93_row0_col4\" class=\"data row0 col4\" >1.234</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <td id=\"T_68e93_row1_col0\" class=\"data row1 col0\" >1234.000000</td>\n", | ||
" <td id=\"T_68e93_row1_col1\" class=\"data row1 col1\" >$1.23\\times10^{3}$</td>\n", | ||
" <td id=\"T_68e93_row1_col2\" class=\"data row1 col2\" >$1.23400\\times10^{3}$</td>\n", | ||
" <td id=\"T_68e93_row1_col3\" class=\"data row1 col3\" >$1.2\\times10^{3}$</td>\n", | ||
" <td id=\"T_68e93_row1_col4\" class=\"data row1 col4\" >1234</td>\n", | ||
" </tr>\n", | ||
" <tr>\n", | ||
" <td id=\"T_68e93_row2_col0\" class=\"data row2 col0\" >0.000012</td>\n", | ||
" <td id=\"T_68e93_row2_col1\" class=\"data row2 col1\" >$1.23\\times10^{-5}$</td>\n", | ||
" <td id=\"T_68e93_row2_col2\" class=\"data row2 col2\" >$1.23400\\times10^{-5}$</td>\n", | ||
" <td id=\"T_68e93_row2_col3\" class=\"data row2 col3\" >$1.2\\times10^{-5}$</td>\n", | ||
" <td id=\"T_68e93_row2_col4\" class=\"data row2 col4\" >$1.234\\times10^{-5}$</td>\n", | ||
" </tr>\n", | ||
" </tbody>\n", | ||
"</table>\n" | ||
], | ||
"text/plain": [ | ||
"<pandas.io.formats.style.Styler at 0x1549faaaf80>" | ||
] | ||
}, | ||
"execution_count": 4, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"yagamee.dataframe_tools.copy_as_latex(df,sigfig_notation)" | ||
] | ||
}, | ||
{ | ||
"cell_type": "markdown", | ||
"metadata": {}, | ||
"source": [ | ||
"```\n", | ||
"\\begin{table}\n", | ||
"\\centering\n", | ||
"\\caption{-----}\n", | ||
"\\begin{tabular}{rllll}\n", | ||
"\\toprule\n", | ||
"original & 小数点2桁 & 小数点5桁 & 有効数字2桁 & 有効数字5桁 \\\\\n", | ||
"\\midrule\n", | ||
"1.234000 & 1.23 & 1.23400 & 1.2 & 1.234 \\\\\n", | ||
"1234.000000 & $1.23\\times10^{3}$ & $1.23400\\times10^{3}$ & $1.2\\times10^{3}$ & 1234 \\\\\n", | ||
"0.000012 & $1.23\\times10^{-5}$ & $1.23400\\times10^{-5}$ & $1.2\\times10^{-5}$ & $1.234\\times10^{-5}$ \\\\\n", | ||
"\\bottomrule\n", | ||
"\\end{tabular}\n", | ||
"\\end{table}\n", | ||
"```" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 6, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [ | ||
"yagamee.dataframe_tools.preview_in_excel(df,sigfig_notation)" | ||
] | ||
} | ||
], | ||
"metadata": { | ||
"interpreter": { | ||
"hash": "b6c9c43045c1bf6f0347fb495437bc8131d6ff429f456aafea4136c77fea4128" | ||
}, | ||
"kernelspec": { | ||
"display_name": "Python 3.10.1 64-bit", | ||
"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.10.1" | ||
}, | ||
"orig_nbformat": 4 | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.