Override global variable inside function not working with Spyder 4
问题 I try to override globally defined Dataframes from within a function. Somehow the global values do not change, printing the dataframes within the functions works with the expected values. import pandas as pd rawData = pd.read_csv("music.csv") appTitles =pd.DataFrame #also with pd.DataFrame() wont get affected def loadTitles(df=rawData): global appTitles appTitles = pd.DataFrame({'Title' : df['title']}) print(appTitles) return appTitles #(second 'print' to screen) #RUN FILE #CALL FUNCTION: