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
#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) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 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: |
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 sys | |
try: | |
import xml.etree.ElementTree as ET | |
except Exception as e: | |
print(str(e)) | |
else: |
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 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 |
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
#!/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={}): | |
''' |
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 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 |
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
""" | |
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 |
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 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 = "" |
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 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) |