Skip to content

Instantly share code, notes, and snippets.

@ritvikmath
Last active April 9, 2019 03:53
Show Gist options
  • Select an option

  • Save ritvikmath/fd67603e4de00fe59c3ca1615615b712 to your computer and use it in GitHub Desktop.

Select an option

Save ritvikmath/fd67603e4de00fe59c3ca1615615b712 to your computer and use it in GitHub Desktop.
store starbucks data into csv file
#define columns of csv
dfSbux = pd.DataFrame(columns=['id', 'strLocation', 'latitude', 'longitude', 'city', 'state', 'zip'])
#store data
for i,col in enumerate(dfSbux.columns):
dfSbux[col] = [item[i] for item in keepLAStores]
#cast the latitude and longitude as floats
dfSbux.latitude = dfSbux.latitude.apply(lambda x: float(x))
dfSbux.longitude = dfSbux.longitude.apply(lambda x: float(x))
#save to csv
dfSbux.to_csv('starbucksInLACounty.csv', index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment