Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
thombashi committed Feb 18, 2019
1 parent 1392392 commit 0c56b22
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 37 deletions.
107 changes: 72 additions & 35 deletions examples/ipynb/pytablewriter_examples.ipynb
Expand Up @@ -69,7 +69,7 @@
}
],
"source": [
"for name in pytablewriter.TableWriterFactory.get_format_name_list():\n",
"for name in pytablewriter.TableWriterFactory.get_format_names():\n",
" print(name)"
]
},
Expand Down Expand Up @@ -105,13 +105,50 @@
}
],
"source": [
"for name in pytablewriter.TableWriterFactory.get_extension_list():\n",
"for name in pytablewriter.TableWriterFactory.get_extensions():\n",
" print(name)"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"# zone\n",
"|zone_id|country_code| zone_name |\n",
"|------:|------------|----------------|\n",
"| 1|AD |Europe/Andorra |\n",
"| 2|AE |Asia/Dubai |\n",
"| 3|AF |Asia/Kabul |\n",
"| 4|AG |America/Antigua |\n",
"| 5|AI |America/Anguilla|\n"
]
}
],
"source": [
"from pytablewriter import MarkdownTableWriter\n",
"\n",
"writer = MarkdownTableWriter()\n",
"writer.table_name = \"zone\"\n",
"writer.headers = [\"zone_id\", \"country_code\", \"zone_name\"]\n",
"writer.value_matrix = [\n",
" [\"1\", \"AD\", \"Europe/Andorra\"],\n",
" [\"2\", \"AE\", \"Asia/Dubai\"],\n",
" [\"3\", \"AF\", \"Asia/Kabul\"],\n",
" [\"4\", \"AG\", \"America/Antigua\"],\n",
" [\"5\", \"AI\", \"America/Anguilla\"],\n",
"]\n",
"\n",
"writer.write_table()"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {
"scrolled": true
},
Expand All @@ -138,7 +175,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -168,7 +205,7 @@
},
{
"cell_type": "code",
"execution_count": 6,
"execution_count": 7,
"metadata": {},
"outputs": [
{
Expand All @@ -193,7 +230,7 @@
},
{
"cell_type": "code",
"execution_count": 7,
"execution_count": 8,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -261,7 +298,7 @@
},
{
"cell_type": "code",
"execution_count": 8,
"execution_count": 9,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -289,7 +326,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": 10,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -343,7 +380,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 11,
"metadata": {},
"outputs": [
{
Expand All @@ -367,7 +404,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 12,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -421,7 +458,7 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 13,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -464,7 +501,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 14,
"metadata": {
"scrolled": true
},
Expand Down Expand Up @@ -512,7 +549,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 15,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -554,7 +591,7 @@
},
{
"cell_type": "code",
"execution_count": 15,
"execution_count": 16,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -582,7 +619,7 @@
},
{
"cell_type": "code",
"execution_count": 16,
"execution_count": 17,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -611,7 +648,7 @@
},
{
"cell_type": "code",
"execution_count": 17,
"execution_count": 18,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -669,7 +706,7 @@
},
{
"cell_type": "code",
"execution_count": 18,
"execution_count": 19,
"metadata": {
"scrolled": true
},
Expand Down Expand Up @@ -699,7 +736,7 @@
},
{
"cell_type": "code",
"execution_count": 19,
"execution_count": 20,
"metadata": {},
"outputs": [
{
Expand All @@ -726,7 +763,7 @@
},
{
"cell_type": "code",
"execution_count": 20,
"execution_count": 21,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -754,7 +791,7 @@
},
{
"cell_type": "code",
"execution_count": 21,
"execution_count": 22,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -782,7 +819,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 23,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -811,7 +848,7 @@
},
{
"cell_type": "code",
"execution_count": 23,
"execution_count": 24,
"metadata": {
"scrolled": false
},
Expand Down Expand Up @@ -847,7 +884,7 @@
},
{
"cell_type": "code",
"execution_count": 24,
"execution_count": 25,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -878,7 +915,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 26,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -907,7 +944,7 @@
},
{
"cell_type": "code",
"execution_count": 26,
"execution_count": 27,
"metadata": {},
"outputs": [
{
Expand All @@ -931,7 +968,7 @@
},
{
"cell_type": "code",
"execution_count": 27,
"execution_count": 28,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -984,7 +1021,7 @@
},
{
"cell_type": "code",
"execution_count": 28,
"execution_count": 29,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1029,7 +1066,7 @@
},
{
"cell_type": "code",
"execution_count": 29,
"execution_count": 30,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1073,7 +1110,7 @@
},
{
"cell_type": "code",
"execution_count": 30,
"execution_count": 31,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1101,7 +1138,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 32,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1137,7 +1174,7 @@
},
{
"cell_type": "code",
"execution_count": 32,
"execution_count": 33,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1179,7 +1216,7 @@
},
{
"cell_type": "code",
"execution_count": 33,
"execution_count": 34,
"metadata": {
"scrolled": true
},
Expand Down Expand Up @@ -1230,7 +1267,7 @@
},
{
"cell_type": "code",
"execution_count": 34,
"execution_count": 35,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1272,7 +1309,7 @@
},
{
"cell_type": "code",
"execution_count": 35,
"execution_count": 36,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1306,7 +1343,7 @@
},
{
"cell_type": "code",
"execution_count": 36,
"execution_count": 37,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -1342,7 +1379,7 @@
},
{
"cell_type": "code",
"execution_count": 37,
"execution_count": 38,
"metadata": {},
"outputs": [
{
Expand Down
3 changes: 1 addition & 2 deletions examples/py/from_pandas_dataframe.py
Expand Up @@ -7,11 +7,10 @@

from textwrap import dedent

import pandas as pd
import pytablewriter
import six

import pandas as pd


df = pd.read_csv(six.StringIO(dedent("""\
"i","f","c","if","ifc","bool","inf","nan","mix_num","time"
Expand Down

0 comments on commit 0c56b22

Please sign in to comment.