Run a few lines at Python startup

By default in debug consoles, Pandas `DataFrame` objects don't show much data:

>>> df
                       runtime  ...            offset
2882 2019-09-02 22:00:00-07:00  ...          00:00:00
2883 2019-09-02 22:00:00-07:00  ...          00:00:00
2884 2019-09-02 22:00:00-07:00  ... -1 days +23:55:00
2885 2019-09-02 22:00:00-07:00  ... -1 days +23:55:00
2886 2019-09-02 22:00:00-07:00  ...          00:00:00
2887 2019-09-02 22:00:00-07:00  ... -1 days +23:55:00
2888 2019-09-02 22:00:00-07:00  ...          00:00:00
2889 2019-09-02 22:00:00-07:00  ...          00:00:00
2890 2019-09-02 22:00:00-07:00  ...          00:00:00
2891 2019-09-02 22:00:00-07:00  ...          00:00:00
2892 2019-09-02 22:00:00-07:00  ...          00:00:00

[11 rows x 6 columns]

If I set a few options, I can see a bit more data, which is helpful:

>>> pd.set_option('display.width', 200)
>>> np.set_printoptions(linewidth=200)
>>> pd.set_option('display.max_columns', 10)

>>> df
runtime datetime datetime_notion variable value offset
2882 2019-09-02 22:00:00-07:00 2019-09-03 00:00:00-07:00 period_beginning RTD 40.2331 00:00:00
2883 2019-09-02 22:00:00-07:00 2019-09-03 00:05:00-07:00 period_beginning RTD 39.8592 00:00:00
2884 2019-09-02 22:00:00-07:00 2019-09-03 00:15:00-07:00 period_beginning RTD 39.4643 -1 days +23:55:00
2885 2019-09-02 22:00:00-07:00 2019-09-03 00:20:00-07:00 period_beginning RTD 39.3471 -1 days +23:55:00
2886 2019-09-02 22:00:00-07:00 2019-09-03 00:20:00-07:00 period_beginning RTD 39.3441 00:00:00
2887 2019-09-02 22:00:00-07:00 2019-09-03 00:30:00-07:00 period_beginning RTD 40.0172 -1 days +23:55:00
2888 2019-09-02 22:00:00-07:00 2019-09-03 00:30:00-07:00 period_beginning RTD 41.1680 00:00:00
2889 2019-09-02 22:00:00-07:00 2019-09-03 00:35:00-07:00 period_beginning RTD 41.9775 00:00:00
2890 2019-09-02 22:00:00-07:00 2019-09-03 00:40:00-07:00 period_beginning RTD 42.6166 00:00:00
2891 2019-09-02 22:00:00-07:00 2019-09-03 00:45:00-07:00 period_beginning RTD 43.1437 00:00:00
2892 2019-09-02 22:00:00-07:00 2019-09-03 00:50:00-07:00 period_beginning RTD 43.6762 00:00:00

I haven't found a good way to set those options globally, though.  It's a pain to have to set them over and over, especially when I'm going in & out of debug sessions so I have to re-establish a console over and over.

Any suggestions?

I'm using IDEA 2021.1 Ultimate on Mac OS 10.15.7, with the Python 211.6693.115 plugin.

Please sign in to leave a comment.