How can I code to accommodate future pandas versions and to silence the warning?

import pandas as pd
import numpy as np
import statsmodels.api as sm
df = pd.DataFrame([[0, 1], [8, 3]],
                                    index=['cat', 'dog'],
                                    columns=['weight', 'height'])
Y = df['weight']
X = df['height']
X = sm.add_constant(X)
model = sm.OLS(Y, X, missing = 'drop')

The code can run, but I got this warning message

/opt/conda/lib/python3.7/site-packages/statsmodels/tsa/tsatools.py:130: FutureWarning: In a future version of pandas all arguments of concat except for the argument 'objs' will be keyword-only
  x = pd.concat(x[::order], 1)

How can I modify the code to silence the warning – and to accommodate future pandas versions? Thanks!

Maybe update your installed statsmodels. They no longer call concat like that. Now they have

x = pd.concat(x[::order], axis=1)

Alternatively, you could use the warnings module

import warnings

with warnings.catch_warnings(category=FutureWarning, record=True) as wanings_list:
  X = sm.add_constant(X)
  # Do something with the warnings in the list `warnings_list`, if you want.