Skip to content

Instantly share code, notes, and snippets.

@solalatus
Created February 28, 2019 15:09
Show Gist options
  • Save solalatus/8f90cad209e960ada17c8b62454adf95 to your computer and use it in GitHub Desktop.
Save solalatus/8f90cad209e960ada17c8b62454adf95 to your computer and use it in GitHub Desktop.
import pandas as pd
from sqlalchemy import create_engine
...
engine = create_engine('postgresql://'+user+':'+password+'@'+host+':'+port+'/'+dbname,echo=False)
df_orderbook = pd.read_sql_query('select * from "public_orderbook"',con=engine)
df_area_filtered_orders = df_orderbook[df_orderbook['dlvryAreaId']=='10YDE-RWENET---I']
df_contract_orders=df_area_filtered_orders[df_area_filtered_orders['contractId']==11064529]
stacked=pd.DataFrame(list(df_contract_orders.BuyOrdrList.apply(pd.Series).stack()))
print(stacked.head(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment