Skip to content

Instantly share code, notes, and snippets.

// Copyright 2023 Chris Pearce
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@cpearce
cpearce / fp.py
Created March 14, 2020 23:00
Three ways to mine frequent patterns...
#!pip install mlxtend
import pandas as pd
import csv
from mlxtend.preprocessing import TransactionEncoder
from mlxtend.frequent_patterns import apriori
def csv_to_tabular(csv_path):
"""
@cpearce
cpearce / csv-reader.py
Last active March 6, 2020 09:21
CSV Reader Example
import csv
def csv_lines(csv_path_name):
with open(csv_path_name) as csv_file:
reader = csv.reader(csv_file)
for row in reader:
# Drop empty values
yield [value for value in row if value]
#!/bin/env python
import json
import sys
skipList = [
"BaseThreadInitThunk",
"CharPrevA",
"CsrAllocateMessagePointer",
"DispatchMessageW",
"DispatchMessageWorker",