Uncategorized
Handling SQLite database using Python

Suppose that the file name of SQLite's database is mpos_S.sqlite, its table (like a sheet of Excel) name is mpos_S, and mpos_S contains column data. If the column name of water temperature data is tp, this column tp contains water temperature data. In order to handle it from Python, you need to import sqlite3. First connect to the database and get the cursor cur. [cc] >>> import sqlite3 >>> conn = sqlite3.connect('mpos_S.sqlite') >>> cur = conn.cursor() [/cc] Check information of columns. [cc] >>> cur.execute("PRAGMA TABLE_INFO(mpos_S)") ### Gets information about columns of table mpos_S >>> cols = cur.fetchall() ### Information of a column is a tuple containing 6 elements. >>> print(cols) […]

Read more
StatsModeling
Install PyMC3 on Windows 10 (Anaconda)

I tried installing PyMC on Windows 10 to learn materials in the book of "Bayesian Methods for Hackers", but I encountered problems, which seems owing to suspension of maintenance. I first created a virtual environment of pymc3 and then installed necessary packages using conda: [cc] > conda create -n pymc3 python=3.6 > activate pymc3 > conda install matplotlib > conda install pymc3 [/cc] However, [cci_python]import pymc3[/cci_python] lead to [cci_python]ModuleNotFoundError[/cci_python]. So did [cci_python]import pymc[/cci_python](installing pymc2). Fortunately I found a solution from this article (in Japanese) and summarized how I accommodated below. First I recreated a virtual environment for pymc3 and then started installing Python3.5 instead of Python 3.6. [cc] > deactivate […]

Read more