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
| import gspread | |
| import pandas | |
| gc = gspread.login('my@email.com', 'supersecretepassword') | |
| book = gc.open('Spreadsheet name') | |
| sheet = book.sheet1 #choose the first sheet | |
| dataframe = pandas.DataFrame(sheet.get_all_records()) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| def epsg_4326_to_900913(lon, lat): | |
| x = lon * 20037508.34 / 180 | |
| y = (math.log(math.tan((90 + lat) * math.pi / 360)) / (math.pi / 180)) * (20037508.34 / 180) | |
| return x, y | |
| def epsg_900913_to_4326(x, y): | |
| lon = x * 180 / 20037508.34 | |
| lat = (360 / math.pi) * math.atan(math.exp(y * math.pi / 20037508.34)) - 90 | |
| return lon, lat |
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
| def read_gdf(path,directed = False): | |
| if directed: | |
| G = nx.DiGraph() | |
| else: | |
| G = nx.Graph() | |
| state = None | |
| nodes = [] | |
| edges = [] | |
| for line in open(path,'r'): | |
| line = line.rstrip() |
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
| def support_jsonp(f): | |
| """Wraps JSONified output for JSONP""" | |
| @wraps(f) | |
| def decorated_function(*args, **kwargs): | |
| callback = request.args.get('callback', False) | |
| if callback: | |
| content = str(callback) + '(' + str(f(*args,**kwargs).data) + ')' | |
| return current_app.response_class(content, mimetype='application/javascript') | |
| else: | |
| return f(*args, **kwargs) |
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
| def to_unicode_or_bust(obj, encoding='utf-8'): | |
| # http://farmdev.com/talks/unicode/ | |
| if isinstance(obj, basestring): | |
| if not isinstance(obj, unicode): | |
| obj = unicode(obj, encoding) | |
| return obj |
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
| from IPython.display import HTML | |
| # To solve the problem : UnicodeDecodeError: 'ascii' codec can't decode byte 0xea in position 83: ordinal not in range(128) | |
| def pdhtml(frame): | |
| return HTML(frame.to_html()) |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>Infinite Scroll Demo...</title> | |
| <script type='text/javascript' src="http://code.angularjs.org/1.0.0rc9/angular-1.0.0rc9.js"></script> | |
| <style type='text/css'> | |
| li { | |
| height: 120px; | |
| border-bottom: 1px solid gray; |
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="content-type" content="text/html; charset=UTF-8"> | |
| <title>Select2 Remote Data Select Example - jsFiddle demo by marcrazyness</title> | |
| <script type='text/javascript' src='//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js'></script> | |
| <script type="text/javascript" src="http://cdnjs.cloudflare.com/ajax/libs/masonry/3.3.0/masonry.pkgd.min.js"></script> |
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
| #!/usr/bin/env python | |
| #-*- coding:utf-8 -*- | |
| import sys | |
| import urllib2 | |
| # This script uses HEAD requests (with fallback in case of 405) | |
| # to follow the redirect path up to the real URL | |
| # (c) 2012 Filippo Valsorda - FiloSottile | |
| # Released under the GPL license |