Source file is unable to upload data using "pd.read_csv" when in a certain directory, whether it's using a Python IDE (Pycharm) or a Jupyter notebook. If I create a source file outside of it, and point it to whatever data I want to upload (whether the data is in the dodgy directory or somewhere else), it works.
I'm a novice, so I'm sure what I could have changed to make source files in this directory behave this way.
I copied the directory, and tried the same in the copied directory and the behavior still stands.
But if I create a new folder, and copy the data files there, and create a source file and operate within the fresh new directory, it works.
This is the code that I was trying to run, and the dataframe came simply as 'not defined':
travel_df = pd.read_csv('/Users/Anon/Projects/Travel/FullData.csv')
travel_df.head()
which returns nothing, and:
if travel_df.empty:
print('DataFrame is empty!')
which returns:
NameError Traceback (most recent call last)
<ipython-input-2-29f39da7c7dc> in <module>()
----> 1 if travel_df.empty:
2 print('DataFrame is empty!')
NameError: name 'travel_df' is not defined
I'm ok with this workaround solution, but I was wondering what about the original directory had been changed that causes this behavior so I can check for it/avoid it in the future.