This file contains 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
import folium | |
import xmltodict | |
TPE_COORDINATES = (25.0375167, 121.5637) | |
map_tpe = folium.Map(location=TPE_COORDINATES, zoom_start=12) | |
with open('freeWifi.xml') as fd: | |
toilet = xmltodict.parse(fd.read()) | |
toilet = toilet['soap:Envelope']['soap:Body']['GetToiletResponse']['GetToiletResult']['diffgr:diffgram'] | |
for each in toilet['NewDataSet']['Table']: | |
lat, lon = each['Lat'], each['Lng'] |
This file contains 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
import folium | |
import xmltodict | |
TPE_COORDINATES = (25.0375167, 121.5637) | |
map_tpe = folium.Map(location=TPE_COORDINATES, zoom_start=12) | |
with open('freeWifi.xml') as fd: | |
wifi = xmltodict.parse(fd.read()) | |
for each in wifi['NewDataSet']['hotspot']: | |
lat, lon = each['LAT'], each['LNG'] | |
text = ', '.join((each['AREA'], each['HOTSPOT_NAME'], each['ADDRESS'])) |
This file contains 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
import folium | |
import pandas as pd | |
TPE_COORDINATES = (25.0375167, 121.5637) | |
map_tpe = folium.Map(location=TPE_COORDINATES, zoom_start=12) | |
for i in range(1, 13): | |
trash_can = pd.read_csv('trash_can{}.csv'.format(i)) | |
for each in trash_can.iterrows(): | |
lat, lon = each[1][4], each[1][3] | |
map_tpe.simple_marker(location=(lat, lon), clustered_marker=True) |
This file contains 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
import folium | |
import pandas as pd | |
TPE_COORDINATES = (25.0375167, 121.5637) | |
map_tpe = folium.Map(location=TPE_COORDINATES, zoom_start=12) | |
water = pd.read_csv('water.csv', encoding='big5') | |
for each in water.iterrows(): | |
lat, lon = each[1][8], each[1][9] | |
map_tpe.simple_marker(location=(lat, lon), popup=each[1][1], clustered_marker=True) | |
map_tpe.create_map('water.html') |
This file contains 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
class C: | |
def __init__(self): | |
self.foo = Foo() | |
def f(self, arg_foo): | |
# call method of C | |
self.other_f() | |
# call method of an object created by f | |
local_foo = Foo() |
This file contains 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
class Shape: | |
def area(self): | |
raise Exception | |
class Square(Shape): | |
def __init__(self, side): | |
self._side = side | |
def area(self): | |
return self._side ** 2 |
This file contains 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
class Square: | |
def __init__(self): | |
self.side = 0 | |
class Rectangle: | |
def __init__(self): | |
self.width = 0 | |
self.height = 0 | |
class Circle: |
This file contains 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
class Node: | |
def __init__(self,initdata): | |
self.data = initdata | |
self.next = None | |
def getData(self): | |
return self.data | |
def getNext(self): | |
return self.next |
This file contains 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |