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
# This is a comment | |
# I typed this directly into http://gist.github.com | |
a = " ".join(["It's",'easy','to','use','to','share','code.']) | |
print(a) |
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 Student: | |
def __init__(self,name,year): | |
self.name= name | |
self.year=year | |
self.grades = [] | |
def __repr__(self): | |
return "{nn} in year {yy}".format(nn=self.name,yy=self.year) | |
def add_grade(self,grade): |
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
# User class. | |
# Tome Rater object contains Users | |
class User(object): | |
def __init__(self, name, email): | |
self.name = name | |
self.email = str(email) | |
self.books = {} | |
def get_email(self): | |
# print(self.email) |
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 TomeRater import * | |
Tome_Rater = TomeRater() | |
#Create some books: | |
book1 = Tome_Rater.create_book("Society of Mind", 12345678) | |
novel1 = Tome_Rater.create_novel("Alice In Wonderland", "Lewis Carroll", 12345) | |
#novel1.set_isbn(9781536831139) | |
nonfiction1 = Tome_Rater.create_non_fiction("Automate the Boring Stuff", "Python", "beginner", 1929452) | |
nonfiction2 = Tome_Rater.create_non_fiction("Computing Machinery and Intelligence", "AI", "advanced", 11111938) |
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 Menu: | |
def __init__(self, name, items, start_time, end_time): | |
self.name = name | |
self.items = items | |
self.start_time = start_time | |
self.end_time = end_time | |
def __repr__(self): | |
sent = "{} Menu: served {} to {}" | |
return sent.format(self.name,self.start_time,self.end_time) |
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
# Data taken from | |
# https://archive.ics.uci.edu/ml/datasets/Tarvel+Review+Ratings | |
# there is an error in the dataset for User 2713 | |
#the row is shifted, and one value is mis-entered. | |
""" | |
Data Set Information: | |
This data set is populated by capturing user ratings from Google reviews. | |
Reviews on attractions from 24 categories across Europe are considered. | |
Google user rating ranges from 1 to 5 and average user rating |
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
# -*- coding: utf-8 -*- | |
desc1 = ''' The scribe takes in JSON output from ElasticSearch results. | |
It then dynamically transforms the output into tabluar format, | |
writing the data straight to an Excel file using an applicable | |
Excel module.''' | |
# See report version 1 "scribe_report.py" for code comments on the core build | |
# verison 1 code now in excel_printer.py | |
import json |
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
# -*- coding: utf-8 -*- | |
# import json | |
# import openpyxl | |
# This next section can be its own script if necessary | |
# begin dont_overwrite ---- | |
ret_values = ['unknown','level_1','level_2','multi_s'] | |
def detectStructure (jsondata): |
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
{ "size": 0, | |
"query": { | |
"term": {"propertyId":"{{property_id}}"} | |
}, | |
"aggs": { | |
"email_recency": { | |
"date_histogram" : { | |
"field": "checkinDate", | |
"interval": "year", | |
"format" : "yyyy-MM-dd" |
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
{ "size": 0, | |
"query": { | |
"term": {"propertyId":"{{property_id}}"} | |
}, | |
"aggs": { | |
"reservation_over_time": { | |
"date_histogram" : { | |
"field": "checkinDate", | |
"interval": "year", | |
"format" : "yyyy-MM-dd" |
OlderNewer