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 json | |
from dataclasses import dataclass | |
from typing import Optional | |
import importlib.resources as pkg_resources | |
from mypackage import control # this points to the folder containing config.json | |
@dataclass | |
class ControlConfig: | |
property_1: bool | |
property_2: str |
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
from matplotlib import pyplot as plt | |
import numpy as np | |
import seaborn as sns | |
dfrad = df.copy() | |
# We want a column for the minute of the day. | |
dfrad['minOfDay'] = 0 | |
for i in range(len(dfrad)): | |
timestr = dfrad.loc[i,'time'] | |
hrs = int(timestr[:timestr.index(':')]) |
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 datetime | |
# Initialise the column | |
df['daynum'] = 0 | |
# Get a list of the elements of the full date | |
fdl = df.iloc[-1]['full_date'].split('-') | |
# Find the datetime object corresponding to the first entry | |
firstDate = datetime.date( |
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 | |
# Read the data | |
df = pd.read_csv('Bobs_daylio_export.csv') | |
# Days where he did no activities should be a blank string | |
df['activities'] = df['activities'].fillna(' ') | |
# Bob made no notes in any of his entries | |
df.drop(columns='note',inplace=True) |