1

I have a pandas data frame like below (one line sample):

df.sample()

    IDData    HP  Feedrate  RPM  Coolant1  Coolant2  Coolant3  Coolant4  ApproachOn  Extreme  Wear  UCut  SlopeHP  AccumulatedWork  CuttingHP       File Time Stamp Tool

60      60  1048         0    0       408         0         0         0       False        0     0     0        0                0        -22   7 1 2019 6 45 22 AM  T12

You can see the File Time Stamp column is strange. I try to run the code below:

df['File Time Stamp'] = pd.to_datetime(df['File Time Stamp'], format='%m %d %Y %I %M %S %p')

The format is correct I believe, but I get an error in VSCode (no traceback from Python) Unable to open 'strptime.pyx': Unable to read file (Error: File not found). What I don't understand is it's looking in the directory of the script I'm running, instead of the pandas folder.

For instance it's looking in (c:\users\directory_of_my_script\pandas\_libs\tslibs\strptime.pyx)) but this pandas folder does not exist obviously.

As a test I ran the same code in Jupyter Notebook and it runs fine, so it seems a VSCode issue.

Why am I getting this error? Why is it looking in the wrong directory?

Using VSCode version 1.37.1

Anaconda version 2019.03

Python version 3.7.3

Chris Macaluso
  • 1,372
  • 2
  • 14
  • 33
  • don't use name `pandas` for your folder because then `import pandas` will try to load from your folder. It is not VSCode issue. It is how `import` works. – furas Sep 03 '19 at 12:26
  • I didn't, everything after c:\users\directory_of_my_script\ is where vscode says it's trying to look, the folder pandas does not exist – Chris Macaluso Sep 03 '19 at 12:36
  • Similar problem described here https://stackoverflow.com/questions/42165649/pandas-read-csv-file-not-found-despite-correct-path-with-raw-text VScode seems to be just much more finicky about unicode/hidden characters in a string compared to the standalone jupyter notebook server. Only thing that worked for me was to copy full path to the file and then use a filename in form `r"C:\Users\..."` – JHuw Oct 14 '19 at 14:57

0 Answers0