diff --git a/examples/ipynb/pytablewriter_examples.ipynb b/examples/ipynb/pytablewriter_examples.ipynb index 6ab3d4c6..90fb69f8 100644 --- a/examples/ipynb/pytablewriter_examples.ipynb +++ b/examples/ipynb/pytablewriter_examples.ipynb @@ -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)" ] }, @@ -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 }, @@ -138,7 +175,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 6, "metadata": {}, "outputs": [ { @@ -168,7 +205,7 @@ }, { "cell_type": "code", - "execution_count": 6, + "execution_count": 7, "metadata": {}, "outputs": [ { @@ -193,7 +230,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 8, "metadata": {}, "outputs": [ { @@ -261,7 +298,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 9, "metadata": {}, "outputs": [ { @@ -289,7 +326,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 10, "metadata": {}, "outputs": [ { @@ -343,7 +380,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 11, "metadata": {}, "outputs": [ { @@ -367,7 +404,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 12, "metadata": {}, "outputs": [ { @@ -421,7 +458,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 13, "metadata": {}, "outputs": [ { @@ -464,7 +501,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 14, "metadata": { "scrolled": true }, @@ -512,7 +549,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 15, "metadata": {}, "outputs": [ { @@ -554,7 +591,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 16, "metadata": {}, "outputs": [ { @@ -582,7 +619,7 @@ }, { "cell_type": "code", - "execution_count": 16, + "execution_count": 17, "metadata": {}, "outputs": [ { @@ -611,7 +648,7 @@ }, { "cell_type": "code", - "execution_count": 17, + "execution_count": 18, "metadata": {}, "outputs": [ { @@ -669,7 +706,7 @@ }, { "cell_type": "code", - "execution_count": 18, + "execution_count": 19, "metadata": { "scrolled": true }, @@ -699,7 +736,7 @@ }, { "cell_type": "code", - "execution_count": 19, + "execution_count": 20, "metadata": {}, "outputs": [ { @@ -726,7 +763,7 @@ }, { "cell_type": "code", - "execution_count": 20, + "execution_count": 21, "metadata": {}, "outputs": [ { @@ -754,7 +791,7 @@ }, { "cell_type": "code", - "execution_count": 21, + "execution_count": 22, "metadata": {}, "outputs": [ { @@ -782,7 +819,7 @@ }, { "cell_type": "code", - "execution_count": 22, + "execution_count": 23, "metadata": {}, "outputs": [ { @@ -811,7 +848,7 @@ }, { "cell_type": "code", - "execution_count": 23, + "execution_count": 24, "metadata": { "scrolled": false }, @@ -847,7 +884,7 @@ }, { "cell_type": "code", - "execution_count": 24, + "execution_count": 25, "metadata": {}, "outputs": [ { @@ -878,7 +915,7 @@ }, { "cell_type": "code", - "execution_count": 25, + "execution_count": 26, "metadata": {}, "outputs": [ { @@ -907,7 +944,7 @@ }, { "cell_type": "code", - "execution_count": 26, + "execution_count": 27, "metadata": {}, "outputs": [ { @@ -931,7 +968,7 @@ }, { "cell_type": "code", - "execution_count": 27, + "execution_count": 28, "metadata": {}, "outputs": [ { @@ -984,7 +1021,7 @@ }, { "cell_type": "code", - "execution_count": 28, + "execution_count": 29, "metadata": {}, "outputs": [ { @@ -1029,7 +1066,7 @@ }, { "cell_type": "code", - "execution_count": 29, + "execution_count": 30, "metadata": {}, "outputs": [ { @@ -1073,7 +1110,7 @@ }, { "cell_type": "code", - "execution_count": 30, + "execution_count": 31, "metadata": {}, "outputs": [ { @@ -1101,7 +1138,7 @@ }, { "cell_type": "code", - "execution_count": 31, + "execution_count": 32, "metadata": {}, "outputs": [ { @@ -1137,7 +1174,7 @@ }, { "cell_type": "code", - "execution_count": 32, + "execution_count": 33, "metadata": {}, "outputs": [ { @@ -1179,7 +1216,7 @@ }, { "cell_type": "code", - "execution_count": 33, + "execution_count": 34, "metadata": { "scrolled": true }, @@ -1230,7 +1267,7 @@ }, { "cell_type": "code", - "execution_count": 34, + "execution_count": 35, "metadata": {}, "outputs": [ { @@ -1272,7 +1309,7 @@ }, { "cell_type": "code", - "execution_count": 35, + "execution_count": 36, "metadata": {}, "outputs": [ { @@ -1306,7 +1343,7 @@ }, { "cell_type": "code", - "execution_count": 36, + "execution_count": 37, "metadata": {}, "outputs": [ { @@ -1342,7 +1379,7 @@ }, { "cell_type": "code", - "execution_count": 37, + "execution_count": 38, "metadata": {}, "outputs": [ { diff --git a/examples/py/from_pandas_dataframe.py b/examples/py/from_pandas_dataframe.py index 1542c311..88255b56 100644 --- a/examples/py/from_pandas_dataframe.py +++ b/examples/py/from_pandas_dataframe.py @@ -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"