import pandas as pd data = pd.DataFrame({'A' : [1, 2, 3, 4], 'B' : [1,2,3,4]}) def test(): global data data = data + 1 test()