TGraph Not Working, Returning Error Message: could not convert argument to buffer or nullptr

Hi, I’m trying to make a simple graph and I keep encountering the error message (along with 11 others): “TypeError: could not convert argument 2 (could not convert argument to buffer or nullptr)”. I have my code below. It is simple looking as I was trying to troubleshoot the same error I was recieving in my main code.
error code

_ROOT Version: 6.26.06
_Platform: Windows 11
_Compiler: JupyterHub


The TGraph constructors need arrays, but your x and y are (Python) lists. One way could be to convert them to arrays when passing them:

import ROOT
from array import array
x = [1,2,3,4,5]
y = [1,4,9,16,25]
gr = ROOT.TGraph(5,array("i",x),array("i",y))

Probably there are other/better ways, though :slight_smile:

In C++ that will be:

{
   double x[5] = {1,2,3,4,5};
   double y[5] = {1,4,9,16,25};
   auto g = new TGraph(5,x,y);
   g->Draw();
}

Thank you so much, solved the problem immediately!