<commit_before>---
layout: post
title: Evaluating Citibike as a commuting option
---

Some facts about me:

 * I'm subletting in Brooklyn for the summer
 * I work all day in the Flatiron District
 * I love biking
 * Riding the subway irritates me

Ergo, I might be a good candidate for the <a href="https://www.citibikenyc.com/" target="_blank">Citibike bike share program.</a>

Yes, Citibike membership is an option. But I didn't want to commit until I had <b>proof that a bike would be available to me at the specific times I would need one</b>.

So, I wrote a simple python script on my remote server to read Citibike's <a href = "https://www.citibikenyc.com/stations/json" target="_blank">system feed data</a> to understand the bike availability at specified stations. It stores selected data into a dictionary (station name, available bikes, available docks, current time), then writes the selected data into a csv file called "citibikedata.csv".

Note: This script is written to work in conjunction with crontabs, to load system data automatically at specified times. Find that code below the python script.

<i>Make it your own:</i> Modify the "my_stations" variable to include any stations you are interested in tracking.

#### citibikefeed.py

```
import urllib, json
import pandas as pd
from datetime import datetime
import os.path

url = "https://www.citibikenyc.com/stations/json"
response = urllib.urlopen(url)
data = json.loads(response.read())<commit_msg>some changes<commit_after>---
layout: post
title: Evaluating Citibike as a commuting option
---

Some facts about me:

 * I'm subletting in Brooklyn for the summer
 * I work all day in the Flatiron District
 * I love biking
 * Riding the subway irritates me

Ergo, I might be a good candidate for the <a href="https://www.citibikenyc.com/" target="_blank">Citibike bike share program.</a>

Yes, Citibike membership is an option. But I didn't want to commit until I had <b>proof that a bike would be available to me at the specific times I would need one</b>.

So, I wrote a simple python script on my remote server to read Citibike's <a href = "https://www.citibikenyc.com/stations/json" target="_blank">system feed data</a> to understand the bike availability at specified stations. It stores selected data into a dictionary (station name, available bikes, available docks, current time), then writes the selected data into a csv file called "citibikedata.csv".

Note: This script is written to work in conjunction with crontabs, to load system data automatically at specified times. Find that code below the python script.

<i>Make it your own:</i> Modify the "my_stations" variable to include any stations you are interested in tracking. Find station names <a href="https://member.citibikenyc.com/map/" target="_blank">here.</a>

#### citibikefeed.py

```
import urllib, json
import pandas as pd
from datetime import datetime
import os.path

url = "https://www.citibikenyc.com/stations/json"
response = urllib.urlopen(url)
data = json.loads(response.read())
{'fraction_non_alphanumeric': 0.08547854785478548, 'fraction_numerical': 0.0, 'mean_word_length': 4.531021897810219, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 7, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6020239', 'n_tokens_mistral': 869, 'n_tokens_neox': 833, 'n_words': 408}