Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Implementing Dublin Bikes Python Code

Options
  • 10-05-2014 12:48pm
    #1
    Registered Users Posts: 481 ✭✭


    Hi there,

    Just looking for a small bit of help in setting up the code in the link below.

    http://shanelynn.ie/index.php/scraping-dublin-city-bikes-data-using-python/

    I want to scrape the Dublin bike data for a number of docking stations and monitor how the system is being used.

    Unfortunately I am not a software developer but am eager to learn.

    Would anyone be able to give me a quick setup guide on how I could get this setup to scrape data in an Excel file located on my desktop?

    Just basic steps like:

    What do I need to download/Install?
    What changes to the code do I need to make to save locally on my machine etc.

    Thanks


Comments

  • Registered Users Posts: 341 ✭✭Mo14


    cherrytaz wrote: »
    What do I need to download/Install?

    You need a python interpreter. I use 2.7 and it worked fine for me, didn't test with 3.*
    The pandas library. Pandas requires dateutil.
    NumPy. I got it from here as I have a 64 bit python install, the one on the official website will work if you use 32 bit
    What changes to the code do I need to make to save locally on my machine

    None, copy it into a text editor, save as bikes.py (or whatever) and run in a command prompt with (assuming windows):

    PATH_TO_PYTHON\python.exe bikes.py

    Then it should save a .db (sqlite) file, and a csv file in the directory the script is saved.
    Unfortunately I am not a software developer but am eager to learn.
    If you just want the data then that's what you need to do to get it, but I'd not recommend starting with someone else's code if you want to learn to program. Get a book, or learn python the hard way.


  • Registered Users Posts: 481 ✭✭cherrytaz


    Thanks very much for that. That's exactly what I was looking for. I work in the transport engineering area so it is literally the data I needed to get.

    Thanks again


  • Registered Users Posts: 481 ✭✭cherrytaz


    Installed at the necessary programs/add-ons but no luck when running through command prompt. Here's where I am at the moment
    python_zps865e6e68.jpg


  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    You need to use the command
    python.exe bikes.py
    


  • Registered Users Posts: 481 ✭✭cherrytaz


    Still no luck


    Untitled_zpsa69cd8be.jpg


  • Advertisement
  • Registered Users Posts: 2,022 ✭✭✭Colonel Panic


    You also need to specify the full path of the bikes.py script, or change directory to where the script is.

    Make sure Python.exe is on your path. Google the docs on how to do that!

    EDIT: Just looked again, you're still trying to run the script from within the interpreter which won't work in this case. Do yourself a favour and look at the Learn Python the Hard Way site mentioned in another post.


  • Registered Users Posts: 481 ✭✭cherrytaz


    Got it working. Apologies for the stupidity in the previous posts. First time at this craic.

    Untitled_zps05dee567.jpg


Advertisement