I'm new to Pycharm as well as python well really coding in general and am having trouble figuring out how to load CSV. files into a python Data frame via pandas then creating a database table via SQLAlchemy so that i can then produce a joined table. Here is as far as i've gotten:
import pandas as pd
import sqlalchemy as sa
df1= pd.read_csv(r'c:\Users\Greg\Documents\Gander.csv')
df2 = pd.read_csv(r'c:\Users\Greg\Documents\LandnSea.csv')
print (df1)
print (df2)
join = sa.MetaData()
Gander = sa.Table(
'Gander',
join,
sa.Column('street',sa.Integer),
sa.Column('city',sa.String),
sa.Column('state',sa.String),
sa.Column('zip',sa.Integer),
)
LandnSea = sa.Table(
'LandnSea',
join,
sa.Column('street', sa.Integer),
sa.Column('city', sa.String),
sa.Column('state', sa.String),
sa.Column('zip', sa.Integer),
)
I'm certain there is a better way to go about my objective but I have limited knowledge with programming.If anyone can shed some light on how to correctly go about this problem some shared knowledge would be greatly appreciated. just to reiterate all this is being done on Python 2.7.
Comments
Post a Comment