Skip to content

Commit

Permalink
Update fetch_data.py
Browse files Browse the repository at this point in the history
  • Loading branch information
lovasoa authored Mar 15, 2020
1 parent 248faac commit 17a99f0
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions fetch_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

def get_stations():
sapi="https://velib-metropole-opendata.smoove.pro/opendata/Velib_Metropole/station_information.json"
stations_df = pd.DataFrame(requests.get(sapi).json()["data"]["stations"]).astype({"stationCode":int}, inplace=True)
stations_df = pd.DataFrame(requests.get(sapi).json()["data"]["stations"]).astype({"stationCode":int})
stations_df.set_index("stationCode", inplace=True)
stations_df.sort_index(inplace=True)
stations_df['station_geo'] = ["{:.5f},{:.5f}".format(s.lat,s.lon) for s in stations_df.itertuples()]
Expand All @@ -22,7 +22,7 @@ def get_statuses():
j = requests.get(sapi).json()["data"]["stations"]
df = pd.DataFrame(j)
df["last_reported"] = df["last_reported"]
df = df.astype({'is_renting':bool, 'stationCode':int,'last_reported':'datetime64[s]'}, inplace=True)
df = df.astype({'is_renting':bool, 'stationCode':int,'last_reported':'datetime64[s]'})
df = df.join(df["num_bikes_available_types"].apply(lambda l: pd.Series({**l[0], **l[1]})))
df = df[["stationCode", "mechanical", "ebike", "is_renting", "last_reported"]]
df.rename({
Expand Down

0 comments on commit 17a99f0

Please sign in to comment.