append an array as a new vector/scalar field from pandas dataframe with programmable filter and paraview's python console

I’d stick with the Progammable Source approach than the Pyhton Console way. A mildly clunky way of saving state/cache is to use custom attributes on self. e.g.

if not hasattr(self, 'frame'):
   frame = pd.read_hdf(...)
   setattr(self, 'frame', frame)
else:
  frame = self.frame

In ParaView 5.6, Python Algorithm makes it possible to add Python classes for readers/filters/writers etc. There, you can easily implement caching mechanisms as needed using class members.