Code interpreter with ChatGPT


Another member mentioned “code interpreter” in ChatGPT plus. I did not fully understand what he was doing at the time. Now I have a better understanding and I think it could be useful to some members.

And not just for machine learning. You could sort the data for a DataMiner download by date, for example, and find the mean return of your universe for each date. Or the compounded returns of the 25 holdings with the highest predicted returns however you are making those predictions. Or whatever.

The code interpreter can be turned on here:

Once it is turned on you can upload a file from your computer. Tell ChatGPT in english what you want to do. It will write the code for you. Ask you if you want to run it and execute it when you tell it to.

The file uploads are limited in size. But for larger files you can give it a test sample (with fewer rows say), see how it runs. Then make changes to the code until you are happy with the output and copy the code to be run on your computer in Jupyter notebooks or Colab.

For those who want to do some machine learning there is no excuse now no matter what you present Python skills are now. i assume one could use this to help learn Python. I certainly intend to see if it will help me learn.

I assume P123 actually has some interest in this post as it will attract people to the AI/ML when available and perhaps increase use of DataMiner and the API. My apologies if my perception is incorrect on that.

Maybe it could even make Dan’s life easier (fewer newbie questions from me). I suspect if I copied some DataMiner code into ChatGPT it could make a few suggestions for any changes I might want to make—especially if I give it some information from P123’s knowledge base (good original code to make changes to). I am not sure on the last but I suspect I can find a use for it.

I do appreciate P123 making this possible, with quality data to use with my—hopefully improving—coding skills. I hope to support AI/ML at P123 in any way possible.


I used chatgpt 3.5 (no code interpreter) to write 75% of the python code I do these days. If you don’t understand what it did you can ask and it will usually explain the code well. For example I used it to write code to parse the xml ranking system to a list so I could modify rankings and then write it back to xml to update the ranking system. While it did take many back and forth to get the code how I wanted it would have taken me two to four times longer to do on my own.

The only thing it cannot really help you with is the specific P123 python api code. But maybe we can get a google colab file with an executable example of each api function from Dan. Or maybe I will muddle through making one and share it with folks.

1 Like


Bard seems pretty good with code and sometimes I think it might even be better.

I certainly have been know to use it as a second opinion or when ChatGPT does not seem to have access to all of its parallel-processors (i.e., doing something stupid). It will also run code in Colab for you without having to copy the code and paste it somewhere else.

It can retrieve your files from GoogleDrive too–after you consider any privacy issues and decide whether you want to let it do that.

I have not tried the paid Colab option but that might give one a powerful combination of features. You would have the option of using or not using Bard with Colab, of course.

BTW, P123 became aware of Colab through me and SteveA. I was working with SteveA on an XGBoost model at the time. He is probably the one who actually posted on P123 about Colab. I think machine learning posts help P123 directly and indirectly.

Truly helps P123, I believe. At least P123 integrates Colab to some extent now as a result of a machine learning post. FWIW.