0

I use jupyter notebook I am trying to read CSV from network

   data= pd.read_csv('\cdtvnas13\scor\ML Projects\Data\Input\', sep='\t', 
           encoding='utf-16_le')

The result is :

   File "<ipython-input-8-5f26daf531ba>", line 2
       crosswalk = pd.read_csv('\cdtvnas13\ACOEAnalytics\ML 
   Projects\Data\Input\', sep='\t', encoding='utf-16_le')
               ^
   IndentationError: expected an indented block

I looked and tried so many tips but without success ...

Thak you for advice

  • this is an indentation error. You have to look out for formatting of code don't mix tabs and spaces – Arpit Solanki Jul 17 '17 at 10:40
  • 1
    1) your link goes to a folder not a file 2) the `\'` at the end of your path is interpreted as an escaped apostrophe, meaning your strings aren't closed properly. Look at the way SO has formatted it. – asongtoruin Jul 17 '17 at 10:40
  • Your error might just be linux/win related – Alessandro Jul 17 '17 at 10:54
  • @asongtoruin thank you. Yes it is a folder and the data is inside this folder. can you please explain more how I can look the way SO has formatted ... – Video retrieval Jul 17 '17 at 11:26
  • @ArpitSolanki Thank you ! – Video retrieval Jul 17 '17 at 11:26
  • @Alessandro I have some doubts about some conflicts linux/win because I have some side issues ( I can't update windows, freezing apllications like sourcetree ...). Can you tell me how can I confirm if there is a linux/win problem ? – Video retrieval Jul 17 '17 at 11:28
  • Even without the indentation error, you can't just provide a path to a folder, you need to include the file name in the path: `pd.read_csv('/cdtvnas13/scor/ML Projects/Data/Input/some.csv'......)` – EdChum Jul 17 '17 at 11:55

1 Answers1

1

Change your path to :

data= pd.read_csv('/cdtvnas13/scor/ML Projects/Data/Input/', sep='\t', encoding='utf-16_le')

as it's escaping on some of the characters, specifically the last single quote \' gets evaluated to just ' which is not the desired behaviour, also check your indentation and put everything on a single line unless you need to line break the command in which case add a line break (see this )

data= pd.read_csv('/cdtvnas13/scor/ML Projects/Data/Input/', \ # <- this adds a line break continuation character
 sep='\t', encoding='utf-16_le')

Also read_csv expects the full path/url to an actual file, you can't provide just a folder path so you should do something like

data= pd.read_csv('/cdtvnas13/scor/ML Projects/Data/Input/mycsv.csv', sep='\t', encoding='utf-16_le')
EdChum
  • 376,765
  • 198
  • 813
  • 562