normally using jupyternotes I can import pandas make my dataframe and export to csv.
I'm trying to automate this reoccurring query with a python script. I can't figure out how to test my script because I cant print out the df to screen. In jupyternotes I just need to type out the df name in any cell and it will display.
here what I'm doing
import pandas as pd
def run_agg_query(db):
df1 = pd.read_sql( "select some query",conn)
display(df1)
but I cant get the df to display.
I think printing the dataframe as a string should do the job for you. Something like this might work -
print(df.to_string())
Hope this helps!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With