from sqlalchemy import create_engine
import pymysql
import pandas as pd
db='mysql+pymysql://developer:11111@192.168.1.11:3306/pos'
db_connection=create_engine(db)
df=pd.read_sql_table(table_name='product2', con=db_connection)
#df1=pd.read_sql_table(table_name='product', con=db_connection)
start_date = '2009-10-19 00:00:00'
end_date = '2010-10-19 23:59:59'
mask = (df['DateCreated'] > start_date) & (df['DateCreated'] <= end_date) #DateFilter
df = df.loc[mask]
t_type=(df['TherapyType']=='C')
df = df.loc[t_type]
df
i am getting this error :-
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-1-5c4885ab0640> in <module>
1 #extract the data from the created table in which dataframe was inserted..
----> 2 from sqlalchemy import create_engine
3 import pymysql
4 import pandas as pd
5 db='mysql+pymysql://developer:devdev@192.168.1.44:3306/pos'
ModuleNotFoundError: No module named 'sqlalchemy'
我已经在python 2中编写了一个代码,我想在python 3中执行此代码,但是我遇到了错误,我无法理解应该怎么做
答案 0 :(得分:0)
sudo pip3 install sqlalchemy,
sudo pip3 install PyMySQL,
我使用这两个命令安装了sqlalchemy
和pymysql
,现在没有任何错误。