Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandas: Show entire rows without truncation

I have a python script that sends off an email on failure using AWS SNS. I'm having an issue where the dataframe gets truncated, and I'm not sure how to show the entire thread. I have tried using the pandas set_option but that does not seem to have any effect.

Is there a way to print out the entire dataframe and show the entire row?

Here is a small snippet of the code:

import pandas as pd
import boto3
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)

session = boto3.Session()
sns = session.client('sns', region_name='us-east-1')

d = {'failed_runs':['296e62fb-1bc2-4e27-8d69-4a2267237698 - FAILED-GSN-INTO', '92b15078-1fcc-41f0-bc20-d933becf23bf - FAILED-ESP2-INTO', 'b04460ef-32a7-403a-8fbe-468effed7f2b - FAILED-HLN-INTO']}

df = pd.DataFrame(d)

response = sns.publish(TopicArn="arn:aws:sns:xxxxxxxxx",
                       Message="""
        Daily Digest for Failed Runs
        ------------------------------------------------------------------------------------

        {}

        ------------------------------------------------------------------------------------


        """.format(df))

This gives me an email like:

       Daily Digest for Failed Runs
       ------------------------------------------------------------------------------------

                                                  failed_runs
0   296e62fb-1bc2-4e27-8d69-4a2267237698 - FAILED-...
1   92b15078-1fcc-41f0-bc20-d933becf23bf - FAILED-...
2   b04460ef-32a7-403a-8fbe-468effed7f2b - FAILED-...
like image 760
sanjayr Avatar asked Oct 16 '25 06:10

sanjayr


1 Answers

You can try to print the df into the output instead of using {}.format(df)

print(df.to_string())
like image 159
KaRaOkEy Avatar answered Oct 18 '25 20:10

KaRaOkEy



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!