-1

I have two lines of code that open two different .csv files one works and one does not. (the CodeMapping.csv file opens, the ValidationMapping.csv does not)

import pandas as pd

codeMapping = pd.read_csv('C:\Database\CodeMapping.csv')
validationMap = pd.read_csv('C:\Database\ValidationsMapping.csv')

Both lines are next to each other in the scipt and both files are at the path specified, I just can't figure this out......

Stacey
  • 4,825
  • 17
  • 58
  • 99
  • 5
    Please post the full error message – Dan Oct 02 '18 at 13:15
  • Hi Dan, there is no error message the code just stops – Stacey Oct 02 '18 at 13:16
  • 1
    Of course the code stops--what you've posted doesn't actually output anything. – John Zwinck Oct 02 '18 at 13:17
  • Are you able to open the same from console or file explorer. Just make sure there is no spelling mistake in filenames. Also are you able to open the second file first. – nandneo Oct 02 '18 at 13:18
  • so `codeMapping.shape` has values but `validationMap.shape` returns...? – Dan Oct 02 '18 at 13:20
  • codeMapping.shape: (62, 17), I can't get a shape for the validationMap (the code stops.....) – Stacey Oct 02 '18 at 13:24
  • "the code stops..." are you sure? I think either it errors or it returns something, that something might be `None`. Is `validationMap is None` true? Also, did you try only reading ValidationsMapping as Nand suggested? Or are you suggesting that the Python interpreter crashes and closes at this point? – Dan Oct 02 '18 at 13:59

1 Answers1

0

Maybe the problem is your backslashes. You should escape them:

codeMapping = pd.read_csv('C:\\Database\\CodeMapping.csv')
validationMap = pd.read_csv('C:\\Database\\ValidationsMapping.csv')
John Zwinck
  • 239,568
  • 38
  • 324
  • 436