Learning how to use dataframes. What am I doing wrong?
My attempt:
import pyodbc
import pandas as pd
from pandas import read_csv
from sqlalchemy import create_engine
from sqlalchemy.engine.url import URL
import time
import csv
import sys
Class Query(object):
def do_something(self):
con={'drivername':'mssql+pymssql','host': 'host-name', 'port': number, 'database': 'databasename','username':'username','password':'asdf'}
query = """ select column1 from schema.table1 """
df=pd.read_sql_query('parse',con,index_col=None,coerce_float=True,params=None,parse_dates=None,chunksize=None)
x=Query()
x.do_something()
the goal is to eventually store this df into a CSV file. Then, I'll need to run the query
query = """ select column2 from schema.table2 """
and append that column into the CSV file. Help please.