1. Development environment:
1) CLion-2016.1.3
- Mixed programming IDE for C/C + + and Python, first install the following 2) 3) compiler re-association
2) Tdm-gcc-4.8.1-3
3) winpython-64bit-3.5.1.3
- Python Scientific computing Environment, note to configure environment variables, if not configured, an easy way is to install the pure python-3.5.1 to add environment variables and then uninstall
4) mysql-5.7.12-winx64
- Zip version, to configure
5) mysql-connector-odbc-noinstall-5.3.6-winx64
- Install the last Control Panel add odbc-system DSN
2. An example of a simple Python connection to MySQL via ODBC
ImportTushareImportPandasImportSQLALCHEMYDF= Tushare.get_hist_data ('SH') Df.drop (['Price_change','P_change','MA5','ma10','ma20','V_MA5','v_ma10','v_ma20'], Axis=1, inplace=True) df['Date'] =Pandas. DataFrame (Df.index, df.index) df['Index'] = Pandas. DataFrame ([i forIinchRange (0, Len (DF))], Df.index) Engine= Sqlalchemy.create_engine ('Mysql+pyodbc://test:[email protected]') Df.to_sql ('SH', Engine, if_exists='Replace', Index=false)
Python and MySQL