I am running an external python session in Mathematica via ExternalEvaluate. It sends commands to the Bloomberg API in command prompt on Microsoft Windows.

I start the session with

session = StartExternalSession["Python"->"String"]

then I run

data = 
  "blp.bds(tickers='BG1120297 Corp',flds=['Involved Participants'])"]

but Mathematica is truncating the output, providing a truncated table:

enter image description here

If I run this directly in command prompt, by decreasing the font I can fit all the data onto the screen (otherwise python truncates it in command prompt). Can I get the same thing to work for Mathematica, so it doesn't cut off the data?


1 Answer 1


You can change options such as pandas.options.display.max_columns to prevent that from happening (Pandas Documentation).

I couldn't understand why you used "Python"->"String". If you remove ->"String" Mathematica automatically convert the data frame for you into an Association and you can display it in different format inside Mathematica.

But if you want to keep it without changing options, calling

Column @ StringSplit[ExternalEvaluate[session, "blp.bds(...).to_string()"], "\\n"]

will print the table in a formatted form or

ExternalEvaluate[session, "blp.bds(...).to_numpy().tolist()"]

for not-formatted form.

  • $\begingroup$ Thank you! To answer your question, the reasons I tentatively used the String type was to get the table output at all. With Expression I just get the final row (but it is now a formatted expression, and all columns are available). $\endgroup$
    – apg
    May 5, 2023 at 13:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.