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
| # ---- Base python ---- | |
| FROM python:3.6 AS base | |
| # Create app directory | |
| WORKDIR /app | |
| # ---- Dependencies ---- | |
| FROM base AS dependencies | |
| COPY gunicorn_app/requirements.txt ./ | |
| # install app dependencies | |
| RUN pip install -r requirements.txt |
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 unittest | |
| class FizzBuzz: | |
| def say(self, number): | |
| if number % 3 == 0 and number % 5 == 0: | |
| return 'FizzBuzz' | |
| elif number % 3 == 0: | |
| return 'Fizz' | |
| elif number % 5 == 0: |
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
| class FizzBuzz: | |
| def say(self, number): | |
| if number % 3 == 0 and number % 5 == 0: | |
| return 'FizzBuzz' | |
| elif number % 3 == 0: | |
| return 'Fizz' | |
| elif number % 5 == 0: | |
| return 'Buzz' | |
| else: | |
| return number |
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 pytest | |
| class FizzBuzz: | |
| def say(self, number): | |
| if number % 3 == 0 and number % 5 == 0: | |
| return 'FizzBuzz' | |
| elif number % 3 == 0: | |
| return 'Fizz' | |
| elif number % 5 == 0: |
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 pytest | |
| class FizzBuzz: | |
| def say(self, number): | |
| if number % 3 == 0 and number % 5 == 0: | |
| return 'FizzBuzz' | |
| elif number % 3 == 0: | |
| return 'Fizz' | |
| elif number % 5 == 0: |
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 pytest | |
| class FizzBuzz: | |
| def say(self, number): | |
| if number % 3 == 0 and number % 5 == 0: | |
| return 'FizzBuzz' | |
| elif number % 3 == 0: | |
| return 'Fizz' | |
| elif number % 5 == 0: |
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 pytest | |
| @pytest.mark.parametrize('test_input, expected', [ | |
| (3, 'Fizz'), | |
| (6, 'Fizz'), | |
| (5, 'Buzz'), | |
| (10, 'Buzz'), | |
| (15, 'FizzBuzz'), | |
| (30, 'FizzBuzz'), |
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 | |
| # | |
| # More of a reference of using jinaj2 without actual template files. | |
| # This is great for a simple output transformation to standard out. | |
| # | |
| # Of course you will need to "sudo pip install jinja2" first! | |
| # | |
| # I like to refer to the following to remember how to use jinja2 :) | |
| # http://jinja.pocoo.org/docs/templates/ | |
| # |
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 pandas as pd | |
| from sklearn import cluster | |
| data = { | |
| 'data': [2, 3, 4, 10, 12, 20, 30, 11, 25] | |
| } | |
| df = pd.DataFrame(data) | |
| kmeans = cluster.KMeans(n_clusters=2) |
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 pandas as pd | |
| import seaborn as sns | |
| titanic_df = pd.read_csv('http://biostat.mc.vanderbilt.edu/wiki/pub/Main/DataSets/titanic3.csv') | |
| titanic_df.head() | |
| sns.countplot(x=titanic_df.survived, hue=titanic_df.sex) | |
| sns.countplot(x=titanic_df.survived, hue=titanic_df.embarked) | |
| sns.boxplot(x=titanic_df.survived, y=titanic_df.age) |