Skip to content

Instantly share code, notes, and snippets.

We can make this file beautiful and searchable if this error is corrected: Unclosed quoted field in line 3.
Start Date,Start Time,Duration,Moving Duration,Non-moving Duration,Exercises,Average HR,Calories,BMR Calories,Sport Type ID,Total Sets,Total Reps,Type,Activity Name
2024-02-12,12:51:27,3511.611083984375,1150.4820556640625,2361.1290283203125,"[{'exercise': None, 'reps': 25, 'volume': 1375000, 'sets': 3}, {'exercise': 'PULL_UP', 'reps': 12, 'volume': 0, 'sets': 3}, {'exercise': 'STRETCH_LYING_ABDUCTION', 'reps': 0, 'volume': 0, 'sets': 1}, {'exercise': 'DUMBBELL_ROW', 'reps': 30, 'volume': 675000, 'sets': 3}, {'exercise': 'PLANK', 'reps': 29, 'volume': 0, 'sets': 3}, {'exercise': 'RUN', 'reps': 0, 'volume': 0, 'sets': 1}, {'exercise': None, 'reps': 0, 'volume': 0, 'sets': 1}, {'exercise': None, 'reps': 28, 'volume': 582500, 'sets': 3}]",108.0,422.0,91.0,10,18,124,strength_training,Chest
2024-02-13,12:50:47,3223.1259765625,1192.051025390625,2031.074951171875,"[{'exercise': None, 'reps': 30, 'volume': 600000, 'sets': 3}, {'exercise': 'ROMANIAN_DEADLIFT', 'reps': 30, 'volume': 750000, 'sets': 3}, {'exercise': 'GOB
import os
import openai
import time
os.environ["OPENAI_API_KEY"] = <your API key>
openai.api_key = os.getenv("OPENAI_API_KEY")
# Starting templates
INQUIRY_PERSONA_starting_template = """
Act as a {INQUIRY_PERSONA}. I {TASK}.
# Function to do the API call. Function returns the completition message
def complete(messages, max_retries=5, delay=5):
for i in range(max_retries):
try:
return openai.ChatCompletion.create(
model="gpt-3.5-turbo-0613", # The deployment name you chose when you deployed the ChatGPT model.
messages=messages,
temperature=0.5,
max_tokens=400,
top_p=1.0,
RESPONNSE_PERSONA = "software engineer"
INQUIRY_PERSONA = "experienced career advisor"
TASK = f"""want to ask for a raise. It has been 5 years since my last raise,
and I believe I proved to be able to maintain a good performance.
I just put down the deposit for a new house, so I really need the money;
I do not want to change my current company, so even if my
manager can't give me a raise, I am not going to resign anyway."""
QUESTIONS = 10
INQUIRY_PERSONA_first = INQUIRY_PERSONA_starting_template.format(INQUIRY_PERSONA=INQUIRY_PERSONA,
# Starting templates
INQUIRY_PERSONA_starting_template = """
Act as a {INQUIRY_PERSONA}. I {TASK}.
You will ask me {QUESTIONS} questions, one at the time.
After each question you will wait for my answer, after my answer you will
ask the next question. When all the {QUESTIONS} questions have been answered,
you will write me the exact steps I have to do to solve my problem.
Remember, ask one question at the time!!!
# Load libraries
import numpy as np
import pandas as pd
import random
from math import sqrt
import math
from sklearn.cluster import KMeans
random.seed(10)
@aialenti
aialenti / dbscan.py
Last active February 17, 2021 14:18
import pandas as pd
from sklearn.cluster import DBSCAN
data = pd.read_csv("data.csv")
data["labels"] = DBSCAN(eps=0.01, min_samples=3).fit(data[["lat","lng"]].values).labels_
print(data["labels"].unique())
data.to_csv("out.csv")
id _price type _bedrooms _bathrooms _ber_code _views days_listed days_listed_random_forest
42 348721 HOUSES 3 1 ber_D1 4022 0 26
43 385119 HOUSES 2 3 ber_C1 2926 0 27
44 429861 HOUSES 2 3 ber_B3 2965 0 27
45 1395761 HOUSES 5 2 ber_C2 8153 13 27
46 385651 HOUSES 3 2 ber_D2 4076 0 27
47 425531 HOUSES 3 3 ber_D1 24621 0 27
49 495981 HOUSES 3 1 ber_D1 8620 13 102
50 65815 HOUSES 4 2 ber_D1 9088 0 27
51 856211 HOUSES 4 3 ber_C3 1749 0 27
id _price type _bedrooms _bathrooms _ber_code _views days_listed
1048 443262 HOUSES 3 1 ber_G 2089 21
1049 175456 HOUSES 2 1 ber_C1 1473 21
1056 625198 HOUSES 4 2 ber_D1 1171 21
1057 267649 HOUSES 3 3 ber_C2 1058 21
1058 525876 HOUSES 3 3 ber_E2 1282 21
1059 495289 HOUSES 4 4 ber_B3 4374 21
1060 1359867 HOUSES 4 4 ber_E1 1998 21
1063 449956 HOUSES 3 1 0 3103 21
1067 290983 HOUSES 3 1 ber_D1 1695 21
id type _bedrooms _bathrooms _ber_code _views days_listed
32 HOUSES 4 3 ber_C3 12723 0
33 HOUSES 5 2 ber_D1 2564 0
36 HOUSES 4 2 ber_F 56031 0
37 HOUSES 3 3 ber_E1 4162 0
38 HOUSES 3 2 ber_E1 3307 0
40 HOUSES 4 2 ber_B2 4324 0
41 HOUSES 4 3 ber_E1 2770 0
42 HOUSES 3 1 ber_D1 4022 0
43 HOUSES 2 3 ber_C1 2926 0