-2

While working on a python tutorial, i have following code that doesn't run and I dont recognize. what kind of import should I do for them in order to have it run?

I did import os, import sys, not helping.

!sudo chown -R jupyter:jupyter /home/jupyter/training-data-analyst
'sudo' is not recognized as an internal or external command,
operable program or batch file.


!ls -l ../data/*.csv
'ls' is not recognized as an internal or external command,
operable program or batch file.

!head ../data/taxi*.csv
'head' is not recognized as an internal or external command,
operable program or batch file.
3
  • I am using Jupiter notebook
    – George
    Oct 22, 2020 at 21:27
  • 1
    Windows doesn't have an ls command... Also, you skipped your first error when creating the question? Oct 22, 2020 at 21:27
  • 2
    Those are unix/linux shell commands and you're clearly on Windows. You'll need some kind of linux-like shell. Although this site doesn't allow recommendation questions, I'll say that your options include Ubuntu for Windows 10, Git Bash, and MinGW Oct 22, 2020 at 21:27

1 Answer 1

1

This isn't Python code. These are Unix commands, not meant to be ran in Windows, which appears that you are.

You shouldn't need to modify permissions of example data, and Python has native functions for listing contents of directory and files that you should be using instead.

For example, os.glob() and open()


Based on the usage of /home/jupyter, I would guess you skipped part of the tutorial that is using a Docker container

6
  • I took the whole thing from a web served notebook and tried to run on my local computer. Guess it not gonna work
    – George
    Oct 22, 2020 at 21:42
  • It would, but you're at least going to need Docker or run Jupyter from WSL2 Oct 22, 2020 at 21:43
  • Personally, I suggest reading the Python code after those cells because the only purpose of those other commands is to show you that the data exists Oct 22, 2020 at 21:44
  • You mean like a virtual environment like Ubuntu mentioned above. Its too much for a starter. I only need read in couple of csvs for learning data science
    – George
    Oct 22, 2020 at 21:46
  • there are nothing above, they are on the beginning except for bunch imports in the middle
    – George
    Oct 22, 2020 at 21:48

Not the answer you're looking for? Browse other questions tagged or ask your own question.