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
def treat_number(i): | |
i = str(i) | |
i = i.replace('+','') | |
i = i.replace('-','') | |
#i = int(i) | |
if i[0] == '1' and len(i) == 11: | |
i = i[1:11] | |
return i |
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
from fuzzywuzzy import process | |
names = ['Megan Sherman','Jin Zhang','Amr Ahmed','Jeffrey De Fauw','Linus Upson','Jonathan Binghman'] | |
emails = ['[email protected]','[email protected]','[email protected]','[email protected]','[email protected]'] | |
names_cleaned = [i.lower() for i in names] | |
emails_cleaned = [i.split('@')[0] for i in emails] | |
for email in emails_cleaned: | |
print '######' |
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
from hashlib import sha256 as sha | |
def chunks(l, n): | |
"""Yield successive n-sized chunks from l.""" | |
for i in range(0, len(l), n): | |
yield l[i:i + n] | |
def m_tree(transactions): | |
"""Takes an array of transactions and computes a Merkle root""" | |
sub_t = [] |
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
from datetime import datetime | |
import requests | |
import json | |
def find_traffic_time(dt): | |
epoch = datetime(1970,1,1) | |
delta_time = (dt - epoch).total_seconds() | |
epoch_t = str(delta_time).split('.')[0] | |
# build query |
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 gemini(object): | |
""" | |
An object for interacting with the Gemini API. Full Gemini API documentation is | |
available at https://docs.gemini.com | |
""" | |
def __init__(self, gemini_api_key, gemini_api_secret, base_url): | |
""" | |
Initializes gemini object. | |
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
openapi: 3.0.0 | |
info: | |
title: "World Modelers Search API" | |
description: "This API specification is for the World Modelers search." | |
version: "1.0.0" | |
paths: | |
/search: | |
post: | |
tags: |
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
date | EthiopiaArrivals | Itoobiya | qaxooti | UN | abaar | shaqada | Oromiya | gargaar | skype | |
---|---|---|---|---|---|---|---|---|---|---|
2017-02-28 | 9834 | 5.5 | 4.0 | 17.75 | 0.0 | 4.25 | 2.25 | 0.0 | 19.25 | |
2017-03-31 | 20515 | 8.5 | 3.0 | 27.0 | 2.5 | 5.0 | 0.0 | 0.0 | 21.0 | |
2017-04-30 | 10797 | 8.0 | 0.0 | 20.0 | 0.8 | 5.6 | 0.0 | 3.2 | 13.2 | |
2017-05-31 | 4876 | 6.5 | 1.25 | 16.75 | 2.5 | 3.5 | 2.5 | 0.0 | 14.0 | |
2017-06-30 | 6184 | 3.5 | 1.25 | 17.0 | 0.0 | 2.5 | 0.0 | 2.5 | 14.75 | |
2017-07-31 | 3311 | 3.4 | 0.0 | 22.8 | 0.0 | 1.4 | 3.0 | 0.0 | 18.6 | |
2017-08-31 | 9288 | 7.5 | 0.0 | 21.25 | 0.0 | 3.25 | 2.25 | 2.25 | 21.0 | |
2017-09-30 | 27144 | 12.75 | 1.5 | 33.25 | 0.0 | 2.25 | 13.0 | 3.25 | 25.25 | |
2017-10-31 | 3229 | 12.2 | 0.0 | 25.2 | 0.0 | 6.0 | 2.4 | 0.0 | 15.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
from elasticsearch import Elasticsearch | |
import json | |
es = Elasticsearch('http://localhost:9200') | |
q = { | |
"query": { | |
"match_all": {} | |
} | |
} |
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 io | |
import pandas | |
import requests | |
import json | |
########################## | |
# generate dataset metadata | |
# I assume this will come from the HMI during user upload | |
########################## | |
dataset = { |
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
>>> can you run an optimization to come up with a geothermal power project that will maximize net cash flow at 20 years. Pick only a few key input parameters to optimize | |
thought: I need to run an optimization to maximize net cash flow for a geothermal power | |
project over a 20-year period. I will select key input parameters for this optimization. | |
tool: optimize_power | |
tool_input: {'input_names': ['no_of_prod_wells', 'flowrate', 'wellhead_temperature', | |
'geothermal_gradient'], 'input_lower_bounds': [1, 25, 100, 50], 'input_upper_bounds': | |
[10, 100, 200, 100], 'params_to_minimize': [], 'params_to_maximize': ['cumsum(Cash | |
Flow)[20]'], 'params_to_target': [], 'target_values': [], 'budget': 100} | |
observation: {'optimized inputs': {'no_of_prod_wells': 8, 'flowrate': 97.83986294796993, |