Different DataFrames saved under filenames with different cases are overwritten
# Generate three different DFs
lower_df = pd.DataFrame({'a':['spam','eggs','ham']})
camel_df = pd.DataFrame({'a':['Spam','Eggs','Ham']})
upper_df = pd.DataFrame({'A':['SPAM','EGGS','HAM']})
# Write out the three DFs to three different CSVs
lower_df.to_csv('ingredients.csv')
camel_df.to_csv('Ingredients.csv')
upper_df.to_csv('INGREDIENTS.csv')
Problem description
Three different datasets, written to filenames with three different case sensitivities, results in only one file being produced.
Expected Output
On Windows 64, only one file is produced: it's titled "ingredients.csv" but contains the data from upper_df
. I would expect three different files to be written out with the corresponding data from each of the three DFs.
Output of pd.show_versions()
Comment From: TomAugspurger
We should be matching the filesystem here. On my Mac that (correctly) has a single file since my filesystem is case insensitive.
Can you check the output of
open('foo.csv', 'wb')
open('FOO.csv', wb')
and let me know if you get one or two files? I assume python is doing the correct thing.
Comment From: brianckeegan
I can confirm that only one file is produced on my Windows 64: the "foo.csv" but not "FOO.csv"
Comment From: brianckeegan
Since it appears that Windows's NTFS and FAT file systems are normally case insensitive, this appears to be the intended functionality and outside the scope of pandas.
Recommend closing and I'll hack my way to another solution.
Comment From: chris-b1
Correct, Windows paths are effectively case insensitive