Q: to_csv is not writing the updated DataFrame I am importing a csv file as a pandas DataFrame. That DataFrame then gets updated and I am trying to write that information back to the original csv file by overwriting the file. After my code completes, I can see the file save time has updated, so it appears to have saved a new version. However, when I open the file, nothing has changed. I have run print statements to ensure that the DataFrame's values have in fact been updated and they appear to be correct. Why would to_csv not send the updated DataFrame?
self.site_data=pandas.read_csv("site_data.csv",index_col=0, keep_default_na=False)
self.site_data.loc[location,"ADDRESS"] = self.location_details["site_address"]
print(self.site_data.loc[location,"ADDRESS"])
self.site_data.to_csv("site_data.csv", encoding="latin")


A: So the problem was much deeper than I had thought and so the cause was not represented in the code I posted, but thankfully it was an easy fix. I have multiple classes in my program and two of them create the object 
self.site_data=pandas.read_csv("site_data.csv",index_col=0, keep_default_na=False)

when initialized. Here's an example, though this is not the actual code:
from example_1 import mass_analysis
from example_2 import mass_import

class mass_analysis:
    def __init__(self):
        self.site_data=pandas.read_csv("site_data.csv",index_col=0, keep_default_na=False)

class mass_import:
    def __init__(self):
        self.site_data=pandas.read_csv("site_data.csv",index_col=0, keep_default_na=False)

class mass_main_ui:
    def __init__(self):
        mass_analysis=mass_analysis()
        mass_import=mass_import()        

So, when mass_main_ui is initialized, both classes accessed the file at the same time and hold the same data within that variable. When the first one writes the data back to the file, the other instance of the file/variable is still "open" so when THAT one writes back to the file, it doesn't have the changes from the first one and writes over anything that it did. The fix was to remove the:
mass_analysis=mass_analysis()

and
mass_import=mass_import()

from the initialization and instead just call that class when needed within the other functions in my program, such as:
mass_import().get_new_data(source_file)

def get_new_data(source_file):
    print("This works")

