Last active
April 9, 2019 03:53
-
-
Save ritvikmath/fd67603e4de00fe59c3ca1615615b712 to your computer and use it in GitHub Desktop.
store starbucks data into csv file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #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