I think you'd better splittingsplit before you do imputation. For instances, Youyou may want to impute missing valuevalues with column mean. In this case, if you impute first with train+valid datasetdata set and split next, then you have used validation datasetdata set before you built your model being built, which is how Data Leakagea data leakage problem comes into picture.
But you might ask, if I impute after splitting, it may be too tedious when I need to do cross validation evaluation. My suggest for that is to use sklearn pipeline. It really simplifies your code, and reducereducex the chance to makeof making a mistake. See Pipeline