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
# Performing K-Means to find 3 clusters using the three variables | |
kmeans = KMeans(n_clusters=3, random_state=0).fit(df[["Age", "Income", "Debt"]]) |
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
# FastETL configuration file | |
# created 2019-02-17 16:45:09.940033 UTC | |
tuplex: | |
- allowUndefinedBehavior: false | |
- autoUpcast: false | |
- csv: | |
- comments: ["#", "~"] | |
- generateParser: true | |
- maxDetectionMemory: 256KB | |
- maxDetectionRows: 100 |
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 cProfile | |
... | |
def fib(n): | |
return n if n < 2 else fib(n - 1) + fib(n - 2) | |
cProfile.run("fib(20)") |
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
@app.command() | |
def elbow(file_path: str, max_clusters: int = 10): | |
""" | |
This command will run K-Means algorithm many times and print the inertia values to the console. | |
""" | |
... |
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
const express = require("express"); | |
const app = express(); | |
const port = 5000; | |
const fib = (n) => { | |
if (n < 2) return n; | |
return fib(n - 1) + fib(n - 2); | |
}; | |
app.get("/", (req, res) => { |
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 cProfile | |
from fib import fib as fibc | |
cProfile.run("fibc(35)") |
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 count_primes(n: int) -> int: | |
"""Returns how many prime numbers are there less than n""" | |
count = 0 | |
primes = [False for i in range(n + 1)] | |
for i in range(2, n): | |
if primes[i] == False: | |
count += 1 | |
j = 2 | |
while j * i < n: |
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 celery import Celery | |
from flask import Flask | |
import time | |
# 1. A function to create Celery object. | |
def make_celery(app): | |
celery = Celery( | |
app.import_name, | |
backend=app.config["CELERY_RESULT_BACKEND"], | |
broker=app.config["CELERY_BROKER_URL"], |
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
@app.command() | |
def compare_with_target(input1: str, input2: str, target: str): | |
# Read CSVs from arguments | |
df1, df2 = pd.read_csv(input1), pd.read_csv(input2) | |
# Generate a comparison report against the target variable | |
report = sv.compare(df1, df2, target) | |
# Render HTML report in your default browser |
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
[context.secrets] | |
EMAIL_USERNAME = "<Your email id>" | |
EMAIL_PASSWORD = "<your email password>" |
OlderNewer