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 os | |
import uuid | |
import sys | |
import glob | |
from pprint import pprint | |
import pandas as pd | |
# pip install python-slugify, pandas | |
from slugify import slugify, Slugify, UniqueSlugify | |
custom_slugify = UniqueSlugify() |
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
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] | |
[email protected] |
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 collections import OrderedDict | |
class Codebook(): | |
def __init__(self, xmlns): | |
self.element_name = 'codeBook' | |
self.xmlns = xmlns | |
def toOderedDict(self): | |
return OrderedDict( | |
[('codeBook', |
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
install.packages(c("forecast", "caTools", "MASS", "corrplot", "Metrics")) | |
library(forecast); | |
library(MASS); | |
library(caTools); | |
library(corrplot); | |
library(Metrics); | |
a = data(Boston) | |
rrcr <- cor(Boston) |
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 pprint import pprint | |
from bs4 import BeautifulSoup | |
from docx import Document | |
from docx.shared import Inches | |
with open("cns-En4243-e-2012.xml", 'rb') as fp: | |
soup = BeautifulSoup(fp, "lxml") | |
vars = soup.find_all("var") |
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
<?xml version='1.0' encoding='UTF-8'?> | |
<codeBook version="1.2.2" ID="EPA-71M0001-F-2017-septembre" xml-lang="en" xmlns="http://www.icpsr.umich.edu/DDI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.icpsr.umich.edu/DDI http://www.icpsr.umich.edu/DDI/Version1-2-2.xsd"> | |
<docDscr> | |
<citation> | |
<titlStmt> | |
<titl> | |
Enquête sur la population active, septembre 2017 [Canada] | |
</titl> | |
<subTitl> | |
Enquête sur la population active, septembre 2017 |
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
I want to be able to read and write some DDI file (an XML standard). My issue is in the implementation. Right now I am using BeautifulSoup4 to read and write. I was wondering if I should create a Class for each of the DDI element? Because following the XML Schema each of the XML element might have different attribute(s). | |
I feel that I over complicating the parser (or my mind is working too much :) | |
excerpt of one of the class... | |
class Survey: | |
def __init__(self, filename): | |
self.soup = self.parse_this_xml_file(filename) |
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
# ***************************************************************************** | |
# UPDATED VERSION AVAILABLE HERE: | |
# https://github.com/LeCoupa/awesome-cheatsheets/blob/master/tools/nanobox_cli.sh | |
# ***************************************************************************** | |
# ***************************************************************************** | |
# LOCAL ENVIRONMENT | |
# ***************************************************************************** |
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
➜ ~ dmesg | tail -20 | |
[ 1519.185525] ata2.00: ACPI cmd e3/00:1f:00:00:00:a0 (IDLE) succeeded | |
[ 1519.186298] ata2.00: ACPI cmd e3/00:02:00:00:00:a0 (IDLE) succeeded | |
[ 1519.186562] ata2.00: configured for UDMA/100 | |
[ 1519.201823] ata1.00: ACPI cmd ef/02:00:00:00:00:a0 (SET FEATURES) succeeded | |
[ 1519.201827] ata1.00: ACPI cmd f5/00:00:00:00:00:a0 (SECURITY FREEZE LOCK) filtered out | |
[ 1519.211960] ata1.00: configured for UDMA/133 | |
[ 1519.476326] psmouse serio1: synaptics: queried max coordinates: x [..5470], y [..4498] | |
[ 1519.567145] PM: resume of devices complete after 729.346 msecs | |
[ 1519.567623] PM: Finishing wakeup. |