Pandas to_csv not writing correctly to nas but working on lokal folders
I wrote a function which should remove duplicate lines from all .csv files in a certain path. When i run the skript on lokal ressources it works fine but when i enter a target in my nas the skript finds and states to process all files but does not drop any duplicate lines. Instead it messes up some lines and occasionally a reprocessing throws: "CRITICAL:root:'utf-8' codec can't decode byte 0xa0 in position 0: invalid start byte"
which seems also to be caused by through the skript messed up data.

I tried os.chdir(path) to make the execution path the target path - No change. I tried file as filename only and as full path - No change. if i read the file from the nas and save it locally, it works again.
I am using Win7 x64

my function looks like this:
```python
compress(path):
    codec='utf-8'
    file=path+name
    df = pd.read_csv(file, sep=';',lineterminator='\n', encoding=codec, index_col=0)
    df.drop_duplicates(subset=None, keep='first', inplace=True)
    df.to_csv(file, header=True, sep=';',line_terminator='\n', encoding=codec, mode='w')
    return 0
``` 

``` 
My Data look like:
;a;b;c;d;e
0;1;1;1;1;1
1;1;1;1;1;1
2;1;1;1;1;1
3;1;1;1;1;1
4;1;1;1;1;1

out comes:

;a;b;c;d;e
0;1;1;1;1;1

1;1;1;1;1;1
2;1;1;1;1;1
3;1;1;1;1;1
4;1;1;1;1;1

I would expect:

;a;b;c;d;e
0;1;1;1;1;1
``` 
Which is also the result when the data are stored localy and not in the nas. Whats wrong here?