Advertisement
galij899

seminar4

Feb 17th, 2019
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.92 KB | None | 0 0
  1. 111111
  2. import json
  3. import requests
  4. import pandas as pd
  5. c = requests.get('https://kudago.com/public-api/v1.4/locations/?lang=&fields=name,timezone&order_by=')
  6. c.text
  7. parsed_string=json.loads(c.text)
  8. cities=pd.DataFrame({'name':[],'timezone':[]})
  9. for row in parsed_string:
  10.     j={'name': row['name'],
  11.         'timezone': row ['timezone']}
  12.     cities=cities.append(pd.Series(j),ignore_index=True)
  13. cities    
  14.  
  15.  
  16. 222222
  17. c = requests.get('https://kudago.com/public-api/v1.4/places/?lang=&fields=title,subway,address&location=spb&categories=cinema&page_size=100')
  18. c.text
  19. parsed_string=json.loads(c.text)
  20. parsed_string = parsed_string['results']
  21. cinema_spb=pd.DataFrame({'title':[],'subway':[],'address':[]})
  22. for row in parsed_string:
  23.     j = {'title': row['title'],
  24.        'subway': row['subway'],
  25.        'address': row['address']
  26.       }
  27.     cinema_spb=cinema_spb.append(pd.Series(j),ignore_index=True)
  28. cinema_spb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement