Skip to content

Instantly share code, notes, and snippets.

View officegeek's full-sized avatar

Tue Hellstern officegeek

View GitHub Profile
@officegeek
officegeek / restcountries.py
Created March 9, 2021 13:39
Demo in Python - restcountries.eu
# Install
!pip install python-restcountries
# From restcountries import RestCountryApi as rapi
from restcountries import RestCountryApiV2 as rapi
# Get Denmark info
country_list = rapi.get_countries_by_name('Denmark')
# Print information
@officegeek
officegeek / database.json
Created March 9, 2021 08:38
ToDo - database file - json
{"1": "My task", "2": "Another task", "3": "Rember to read", "4": "Read about FastAPI"}
@officegeek
officegeek / main.py
Created March 9, 2021 08:30
ToDo app - main.py
from fastapi import FastAPI, Request
from fastapi.responses import RedirectResponse
from fastapi.templating import Jinja2Templates
import json
app = FastAPI()
templates = Jinja2Templates(directory="templates")
@app.get("/")
async def root(request: Request):
@officegeek
officegeek / todolist.html
Created March 9, 2021 08:23
ToDo API app - html file
<html>
<head>
<title>MyTODO list</title>
</head>
<style>
*{
margin: 0;
}
table {
align-items: center;
conda install -c r r-irkernel
install.packages("ggplot2")
@officegeek
officegeek / SetupPandas.py
Created November 18, 2020 17:20
Setup pandas
# Install packages
pip install pandas
pip install xlsxwriter
# pip install xlrd
# pip install openpyxl
# Use packages
import pandas as pd
@officegeek
officegeek / CreateExcel.py
Last active November 18, 2020 17:55
Create Excel file
# Opret en Pandas DataFrame ("Tabel") med noget data - Navn og Alder
df = pd.DataFrame({'Navn': ['Ole', 'Per', 'Lise', 'Kim'],
'Alder': [10, 30, 25, 50]})
# Opret en Excel fil, med Sheet1 ved at bruge XlsxWriter
writer = pd.ExcelWriter('MyData.xlsx', engine='xlsxwriter')
# Gem Pandas DataFrame over i Excel filen - index = row nummer
df.to_excel(writer, sheet_name='Sheet1', index=False)
@officegeek
officegeek / JupyterLabInstallLocal.ipynb
Created November 17, 2020 17:27
Install JupyterLab local
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.