Skip to content

Instantly share code, notes, and snippets.

View UweZiegenhagen's full-sized avatar
💭
TeXing happily!

Uwe Ziegenhagen UweZiegenhagen

💭
TeXing happily!
View GitHub Profile
@UweZiegenhagen
UweZiegenhagen / tikzcube.tex
Created December 2, 2024 20:23
tikz cube
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{calc}
@UweZiegenhagen
UweZiegenhagen / cube.tex
Created November 27, 2024 17:31
TikZ Cube with coordinates
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{xcolor}
\usepackage{tikz}
\begin{document}
@UweZiegenhagen
UweZiegenhagen / PocketMod_for_A3.tex
Created August 28, 2021 17:33
Pocket Mod for A3 paper, using LaTeX and TikZ
\documentclass[21pt]{scrartcl}
\usepackage[left=2cm,right=2cm, top=2cm,bottom=2cm,a3paper]{geometry}
\usepackage{forloop}
\setlength{\parindent}{0pt}
\usepackage{tikz}
\newcounter{ct}
\usepackage{pgfpages}
@UweZiegenhagen
UweZiegenhagen / Medium-20210509-complete.py
Created May 9, 2021 08:44
Complete Medium 20210509 code
import sys
import collections
import pandas as pd
file1 = pd.read_csv('file1.csv', sep=';', encoding='UTF-8')
file2 = pd.read_csv('file2.csv', sep=';', encoding='UTF-8')
columnnames1 = list(file1)
columnnames2 = list(file2)
@UweZiegenhagen
UweZiegenhagen / Medium-20210509-4.py
Created May 9, 2021 08:39
Medium-20210509-4.py
# names of the comparison column
check_colnames= [s + '_c' for s in columnnames1]
# initialize an empty dataframe for the log
logdf=pd.DataFrame(index=[True,False])
for column in check_colnames:
t=comparison[column].value_counts() # returns a series
tt=pd.DataFrame(t) # makes a DF out of the series
logdf = logdf.join(tt,how='outer') # join the two dfs
A_c A_e A_t B_c B_e B_t C_c C_e C_t D_c D_e D_t Key_c Key_e Key_t
0 False 1 nan False A nan False 1 nan False J nan False 1 nan
1 True 1 1 False A B True 2 2 False J N True 2 2
2 True 1 1 True A A True 3 3 True J J True 3 3
3 False 1 2 True A A False 4 6 True J J True 4 4
4 True 1 1 True A A True 5 5 True J J True 5 5
5 False nan 1 False nan A False nan 1 False nan
@UweZiegenhagen
UweZiegenhagen / Medium-20210509-3.py
Last active May 9, 2021 08:53
Medium-20210509-3.py
# column names for the comparison column
check_colnames= [s + '_c' for s in columnnames1]
# add suffixes to distinguish between actual and expected in the merger
file1 = file1.add_suffix('_e') # expected
file2 = file2.add_suffix('_t') # actual, true result
# merge them using the given key, use outer join
comparison = pd.merge(file1,file2, how='outer',
left_on=['Key_e'],
@UweZiegenhagen
UweZiegenhagen / Medium-20210509-2.py
Last active May 9, 2021 08:02
Medium-20210509-2.py
# load both files into separate dataframes
file1 = pd.read_csv('file1.csv', sep=';', encoding='UTF-8')
file2 = pd.read_csv('file2.csv', sep=';', encoding='UTF-8')
# save the list of column names for each dataset
columnnames1 = list(file1)
columnnames2 = list(file2)
# check if the columns match
if collections.Counter(columnnames1) == collections.Counter(columnnames2):
@UweZiegenhagen
UweZiegenhagen / import.py
Last active May 9, 2021 07:57
Medium_20210509_1
import sys
import collections
import pandas as pd
@UweZiegenhagen
UweZiegenhagen / parse-qif.py
Created February 15, 2020 14:32
Parsing Lexware Finance Manager / Quicken QIF files
# -*- coding: utf-8 -*-
"""
Created 20200215
@author: Uwe Ziegenhagen, ziegenhagen@gmail.com
Initial version, needs heavy refactoring
See https://github.com/jemmyw/Qif/blob/master/QIF_references for info
"""