Python mariadb and pandas and Plot (on win10)
- Install python 3.9 on windows 10 by print “python” on console (black screen) . Then windows 10 will popup Microsoft Store , just get Get and then program start install python on your machine.
2. Now goto console again (“cmd.exe”) and test python by type “python” on console . Result like this .
3. Install package
mariadb , pandas , numpy and other
3.1 install mariaDB package
3.1.1 Install package with pip ( Ref: https://mariadb.com/resources/blog/how-to-connect-python-programs-to-mariadb/)
3.1.2 Test query data from mariadb database
( Newline with ALT+ENTER )
must display data from database
3.2 install pandas with pip
Test can use pandas by
3.2.1 install pandas
3.2.1 install matplotlib and sqlalchemy
3.2.2 try to connect DB but error : No module named MySQLdb
3.2.2.1 must install mysql package
Then try create engine again
(REF : https://docs.sqlalchemy.org/en/14/dialects/mysql.html )
(REF: https://www.cdata.com/kb/tech/mariadb-python-pandas.rst )
3.2.2.1 create “dataframe” ( df ) with pandas
(REF: https://www.cdata.com/kb/tech/mariadb-python-pandas.rst )
3.2.2.2 Plot Graph
( REF: https://stackoverflow.com/questions/49059956/pandas-plot-value-counts-barplot-in-descending-manner
REF: https://www.cdata.com/kb/tech/mariadb-python-pandas.rst)
3.2.2.3 Try to auto save picture of graph
3.2.2.4 try display another graph type
3.2.2.5 Save Image of graph to file
(REF: https://chartio.com/resources/tutorials/how-to-save-a-plot-to-a-file-using-matplotlib/)
3.2.2.6 Try to create Pivot Table
(REF: https://www.analyticsvidhya.com/blog/2020/03/pivot-table-pandas-python/ )
3.2.2.7 Plot graph from Pivot Table
(REF: https://www.analyticsvidhya.com/blog/2020/03/pivot-table-pandas-python/)
วันนี้ ขอจบแค่นี้ก่อนนะครับ