how to set pandas dataframe as global

Solutions on MaxInterview for how to set pandas dataframe as global by the best coders in the world

showing results for - "how to set pandas dataframe as global"
Mira
20 Sep 2016
1import pandas as pd
2
3data = pd.DataFrame({'A' : [1, 2, 3, 4],
4                     'B' : [1,2,3,4]})
5def test():
6    global data
7    data =  data + 1
8
9test()
10
Alberto
05 Jun 2018
1import pandas as pd
2
3data = pd.DataFrame({'A' : [1, 2, 3, 4],
4                     'B' : [1,2,3,4]})
5
6def test(data):
7   data =  data + 1
8   return data
9
10data = test(data)
11