Skip to content

Instantly share code, notes, and snippets.

View maria-aguilera's full-sized avatar

Maria Aguilera García maria-aguilera

View GitHub Profile
@winnydejong
winnydejong / parseXML.py
Created July 25, 2018 08:41
Parsing XMLs with XPath and ElementTree XML API
"""
The ElementTree documentation shows how to parse XML using XPath:
https://docs.python.org/3.4/library/xml.etree.elementtree.html#example
"""
import xml.etree.ElementTree as ET
root = ET.fromstring(countrydata)
# Top-level elements
@snakers4
snakers4 / process_wikipedia.py
Last active January 4, 2023 22:19
Post process wikipedia files produced by wikiextractor
import os
import re
import sys
import glob
import nltk
import gensim
import numpy as np
import pandas as pd
from tqdm import tqdm
from uuid import uuid4
@audy
audy / xml-to-dict.py
Created October 22, 2018 19:34
Convert nested XML data into dictionaries
#!/usr/bin/env python3
import xml.etree.ElementTree as ET
from pprint import pprint
import code
tree = ET.parse('biosample_result.xml')
def expand_blob(blob, attributes={}):
'''
import matplotlib
import seaborn as sns
import pandas as pd
from scipy.stats import zscore
from sklearn.preprocessing import MinMaxScaler
from sklearn.cluster import DBSCAN
from matplotlib import cm
from datetime import datetime
from dateutil import parser
import json
@onlyforbopi
onlyforbopi / Python.XML.ElementTree.Adv.py
Last active July 31, 2024 10:27
#XML #xml #py #python #xmlhandling #xmlparsing
import os
import sys
try:
import xml.etree.ElementTree as ET
except Exception as e:
print(str(e))
else:
@slogsdon7
slogsdon7 / ex.py
Last active July 31, 2024 10:27
xml parsing in python
from xml.etree import ElementTree
tree = ElementTree.parse('Users.xml')
root = tree.getroot() # <Element 'users' at 0x105f0e950>
#The root is an array/iterator, so child elements can be accessed with array syntax
row = root[0] # <Element 'row' at 0x105f0e9b0>
row.attrib['DisplayName'] # This is how you access attributes directly
data = []
for row in root:
@akashpalrecha
akashpalrecha / an-inquiry-into-matplotlib-figures.ipynb
Last active December 27, 2024 14:38
An Inquiry into Matplotlib's Figures, Axes, subplots and the very amazing GridSpec!
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
#Canvas
fig,ax = plt.subplots(1,1,figsize=(13,7.5),dpi=100)
#Chart
ax.plot(x,y,color=palette["primary_chart"],
zorder=2)
ax.scatter(x,y,color=palette["background"],
edgecolor=palette["primary"],
s=90,
zorder=3)
#Canvas
fig,ax = plt.subplots(1,1,figsize=(13,7.5),dpi=100)
#Chart
ax.plot(x,y,color=palette["primary_chart"],
zorder=2)
ax.scatter(x,y,color=palette["background"],
edgecolor=palette["primary"],
s=90,
zorder=3)
@ksv-muralidhar
ksv-muralidhar / outlier_detect_1.py
Created February 16, 2021 03:24
outlier detection
from sklearn.datasets import load_wine
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
data = pd.DataFrame(load_wine()["data"],columns=load_wine()["feature_names"])
data.head()