none
Immediate Window settings in Python

    Question

  • I'm using Visual Studio 2017 for Python development. I frequently use the Immediate Window (and/or the Debug Interactive Window --- this question applies to both) to check the value of pandas DataFrames while running code. The default setting for showing large DataFrames (e.g. one with a large number of columns) is to show a few columns, followed by an ellipses ... followed by the last few columns. You can override this by using the following setting:

    pd.set_option("display.max_columns", 999)

    This sets the maximum number of columns displayed (without any ellipses in-between) to 999.

    My problem is that every time I hit Run to run the program I'm testing, it resets the number of columns displayed to the default, and I have to re-enter the above command every time I run the program. This is tedious and time-consuming. Is there a way to change the default so I don't have to enter the above every time I run the program? There are other default settings as well, e.g. for the maximum number of rows displayed without an ellipses, and the column width of the display output. I'd like to set these default settings as well.

    Tuesday, April 9, 2019 3:23 PM

All replies

  • Hi ED_White,

    Welcome to MSDN forum.

    According to your description, you can create startup scripts for the python environment in the profile_default/startup directory.

    Please refer to the following example to create the script:
    import pandas as pd
    pd.set_option('display.max_rows', 999)
    pd.set_option('precision', 5)

    If there are many scripts in folder, they will be run in order of their name. 

    Best Regards,

    Dylan


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Wednesday, April 10, 2019 8:03 AM
  • Thanks. Where typically is that profile_default/startup folder? Is it under Visual Studio or python?
    Wednesday, April 10, 2019 2:57 PM
  • Hi Ed_White,

    Sorry for this delay in replay.

    The folder is in your python directory. Please refer to here

    Regards,

    Dylan

    Note: This response contains a reference to a third-party World Wide Web site. Microsoft is providing this information as a convenience to you. 
    Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there.
    There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Thursday, April 18, 2019 8:54 AM