VAR model ValueError: x already contains a constant
Your two columns X0 and X4 are constants, i.e. they contain a single value throughout.

The model will be trying to find a constant during its fit, so probably has a check that you're not including one.

Once you have your entire dataframe (e.g. called df), you can remove constant columns like the two above by using:

df_no_constants = df.loc[:, (df != df.iloc[0]).any()]


Then try putting that into your model as before.