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
#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)
@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.
@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:
@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:
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
@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={}):
'''
@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
@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
@estasney
estasney / extract_xml.py
Created July 13, 2018 01:46
Parsing XML of Stack Overflow Data Dumps
from gensim.utils import smart_open
from collections import defaultdict, OrderedDict
import csv
import xml.etree.ElementTree as ET
headers = ['AcceptedAnswerId', 'AnswerCount', 'ClosedDate', 'CommentCount', 'CommunityOwnedDate', 'CreationDate',
'FavoriteCount', 'Id', 'LastActivityDate', 'LastEditDate', 'LastEditorDisplayName', 'LastEditorUserId',
'OwnerDisplayName', 'OwnerUserId', 'ParentId', 'PostTypeId', 'Score', 'Tags', 'Title', 'ViewCount']
file_path = ""
@ishashankverma
ishashankverma / ebox_parse.py
Created July 4, 2018 15:36
Parse function for parsing ebox url
import requests
import xml.etree.ElementTree as ET
url = 'http://test.cognizant.e-box.co.in/uploads/data_usage.xml'
# Getting the xml data from url
req = requests.get(url)
text = req.text
# Parsing the xml
root = ET.fromstring(text)