Skip to content

Instantly share code, notes, and snippets.

View brew's full-sized avatar
🚀
Floating through space

Brook Elgie brew

🚀
Floating through space
View GitHub Profile
@brew
brew / aggretate_dups_csv.py
Last active February 12, 2019 16:22
Aggregates values for rows with duplicate index keys
import pandas
value_keys = [
"MONTO_APROBADO",
"MONTO_MODIFICADO",
"MONTO_EJERCIDO"
]
FILENAME = 'OS_Presupuesto_2018CDMX'
@brew
brew / dedup.py
Created February 6, 2019 12:16
Remove duplicate rows from source file based on subset of columns
import pandas
df = pandas.read_csv('OS_Presupuesto_2018CDMX.csv', encoding='latin_1')
df.drop_duplicates(inplace=True, subset=[
"CICLO",
"GOBIERNO_GEN",
"SECTOR",
"SUBSECTOR",
"UNIDAD_RESPONSABLE",
"FINALIDAD",
@brew
brew / example.xls
Last active March 23, 2018 17:08
Basic fiscal data for integration testing of Open Spending
year,amount
2018,1000
@brew
brew / gumtreeads-aupairsanalysis1-xls.json
Created October 24, 2017 12:24
GoodTables report for "au pair" analysis
{
"time": 0.466,
"valid": false,
"error-count": 13,
"table-count": 1,
"tables": [
{
"time": 0.457,
"valid": false,
"error-count": 13,
@brew
brew / uk-gov-petitions.json
Created October 5, 2017 10:40
Vega view for a visualisation of uk.gov petition data
{
"width": 800,
"height": 200,
"data": [
{
"name": "stocks",
"url": "https://gist.githubusercontent.com/brew/a071efd8fb3dcd28854630d5b8d9ea95/raw/a9d9f9bdfa3c26f960967f0d7897f358106cf3c2/uk-gov-petitions.csv",
"format": {
"type": "csv",
"parse": {"starting": "date:'%Y-%m-%d %H:%M:%S'"}
@brew
brew / farm-survey.json
Created October 5, 2017 10:31
Vega view for a visualisation of Work Horses vs Tractors
{
"width": 800,
"height": 200,
"data": [
{
"name": "farm-survey",
"url": "https://gist.githubusercontent.com/brew/9cd259fda775ad3f7713ca8f2b623aaa/raw/e8c4dc4b2af82032d1c1ffd42ecd6acc2484a74a/farm-survey",
"format": {
"type": "csv",
"parse": {
This file has been truncated, but you can view the full file.
UniqueRecord,FMSFarm,Year,WeeklyWage,API,CPI,FPI,RG,RG_Eq,CensusSizeCategories,AreaFarmed,GrassArea,TotalGrassArea,TotalCropArea,Crop_pcent,Y1wheat,Y2barley,Y3oats,Y4sbeet,Y5pots,Y9eggs,Y10milk,MilkYield_acre,MilkYield_100Conc,MilkYield_100Conc_MA3,O2cereal,O3othcr,O4hortic,O5cattle,O6sheep,O7pigs,O8poultry,O9dairy,Enterprises,P5cattle,P6sheep,P7pigs,P8poultry,AllPurchases,WorkHorses,TotalOutput,GrazingOutput,GrazingOutput_acre,CropOutput,CropOutput_acre,CerealOutput_100_Fert,OtherCrop_100_TotalOutput,CropOutput86,CropOutput86_acre,AnimalOutput,AniOutput_100_Conc,AniOutput_100_Conc_MA3,MaxOutput,TotalNetOutput,Cattle_DairyNetOutput,SheepNetOutput,GrazingNetOutput,GrazingNetOutput_acre,PigsNetOutput,PoultryNetOutput,NetAnimalOutput,NetAniOutput_100_Conc,NetAniOutput_100_Conc_MA3,MaxNetOutput,GrazingOutput86,GrazingOutput86_acre,GrazingNetOutput86,GrazingNetOutput86_acre,AbsLab,I9lab,I1ferts,I2pests,I3miscc,I4seed,I5Conc,I6vet,I7lscosts,I8rent,I10mach_costs,I11bldng,I12drain,I13misc,AverageK,TotalCosts,TotalCos
We can't make this file beautiful and searchable because it's too large.
id,title,department,starting,closing
10000,Introduce a Penal Colony on the Falkland Isla,Ministry of Justice,2011-08-12 09:34:20,2012-08-17 10:06:09
10005,Tackling Bullying & Homophobia,Department for Education,2011-08-12 09:34:51,2012-08-22 14:38:29
10006,Block Mobile Phone Signals In Schools/Educati,Department for Education,2011-08-12 09:35:00,2012-08-18 14:40:09
10010,"Reduce signatures required to 10,000 for e pe",Office of the Leader of the House of Commons,2011-08-12 09:37:23,2012-05-12 16:22:48
10011,Ban Factory Farming,"Department for Environment, Food and Rural Af",2011-08-12 09:37:50,2012-08-17 13:28:49
10012,Social services to act on parents of looters,Department for Education,2011-08-12 09:37:53,2012-08-25 14:27:58
1002,Give Us Back our Wild Flowers,"Department for Environment, Food and Rural Af",2011-08-03 08:06:20,2012-08-10 11:52:09
1005,Scrap the law which allows only condensing bo,Department for Communities and Local Governme,2011-08-03 09:34:59,2012-08-19 08:57:58
1008,Scap the VAT rate,Her
symbol date price
MSFT Jan 1 2000 39.81
MSFT Feb 1 2000 36.35
MSFT Mar 1 2000 43.22
MSFT Apr 1 2000 28.37
MSFT May 1 2000 25.45
MSFT Jun 1 2000 32.54
MSFT Jul 1 2000 28.4
MSFT Aug 1 2000 28.4
MSFT Sep 1 2000 24.53
@brew
brew / print-psc.csv
Last active September 29, 2017 09:44
ref day month date source article cap_n g4_n serc_n cap_t g4_t serc_t cap_sc g4_sc serc_sc
1 1 1 01/01/2005 0 0 0 0 0 0 0 0 NA NA NA
2 2 1 02/01/2005 0 0 0 0 0 0 0 0 NA NA NA
3 3 1 03/01/2005 0 0 0 0 0 0 0 0 NA NA NA
4 4 1 04/01/2005 6 1 0 0 5 0 0 0 NA NA 8
5 4 1 04/01/2005 6 1 0 0 3 0 0 0 NA NA 8
6 5 1 05/01/2005 0 0 0 0 0 0 0 0 NA NA NA
7 6 1 06/01/2005 9 1 0 2 0 0 0 0 NA 5 NA
8 7 1 07/01/2005 0 0 0 0 0 0 0 0 NA NA NA
9 8 1 08/01/2005 0 0 0 0 0 0 0 0 NA NA NA