Skip to content

Instantly share code, notes, and snippets.

totalKilocalories activeKilocalories restingHeartRate sleepingSeconds
2629.0 407.0 49 27960
2710.0 488.0 47 27600
2759.0 449.0 51 23340
2912.0 612.0 47 26760
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 pandas as pd
from tqdm import tqdm
import csv
import random
import string
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
random.seed(1999)
# 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)
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
from pyspark.sql import SparkSession
from pyspark.sql.functions import *
from pyspark.sql import Row, Window
from pyspark.sql.types import IntegerType
import hashlib
# Init spark session
spark = SparkSession.builder \
.master("local") \
.config("spark.sql.autoBroadcastJoinThreshold", -1) \