I have posted a complete description with copies of code and screenshots here: https://stackoverflow.com/questions/60426506/file-is-not-listed-in-directory-but-can-be-written-and-loaded-from-there-with-p (The responses there show that the respondents don’t know Python.)
The csv file is being written with this command:
I can read this file from the same Python program, and print (correclty) the first row with:
import pandas as pd
city_data = pd.read_csv(“c:\\YelpData\\Data_PA.csv”, usecols=range(1,11), encoding=‘latin-1’)
The file is not present in c:\YelpData (from Windows). It is not a hidden file.
In doing a lot of testing scenarios I have determined the following:
- I can’t write the csv file to a non-existent directory. (Expected.)
- I can write the csv file to an existing directory, then delete that directory, and then the Python program (a new instance) continues to be able to read the file from the deleted directory. (!!!) (Not expected.)
- I can add a file to the directory, with the same name, with 0 size (Data_PA.csv), and Python continues to read the file it previously wrote (to somewhere) (!!!) (Not expected.)
I uninstalled Python 3.6.2 and installed Anaconda. I get the same results.
I have never set up any virtual environments on this laptop, and I have never worked on Jupyter notebooks.
Thanks for any help.