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
| # -*- coding: utf-8 -*- | |
| """ | |
| Created on Tue Jul 31 19:41:31 2018 | |
| @author: User | |
| """ | |
| import xml.etree.ElementTree as ET | |
| from copy import deepcopy |
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
| #To run | |
| #python dl.py k /mnt/k | |
| # | |
| #!/usr/bin/env python | |
| from __future__ import with_statement | |
| import os | |
| import sys |
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 re, string, unicodedata | |
| import nltk | |
| #import contractions | |
| #import inflect | |
| from bs4 import BeautifulSoup | |
| from nltk import word_tokenize, sent_tokenize | |
| from nltk.corpus import stopwords | |
| from nltk.stem import LancasterStemmer, WordNetLemmatizer | |
| def remove_non_ascii(word): | |
| """Remove non-ASCII characters from list of tokenized words""" |
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
| elevation=nullif(@elevation_,''), | |
| latitude=nullif(@latitude_,''), | |
| longitude=nullif(@longitude_,''), | |
| date=nullif(@date_,''), | |
| reporttpye=nullif(@reporttpye_,''), | |
| hourlyskyconditions=nullif(@hourlyskyconditions_,''), | |
| hourlyvisibility=nullif(@hourlyvisibility_,''), | |
| hourlyprsentweathertype=nullif(@hourlyprsentweathertype_,''), | |
| hourlydrybulbtempf=nullif(@hourlydrybulbtempf_,''), |
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
| create table weather ( | |
| station varchar(20) | |
| ,station_name varchar(200) | |
| ,elevation float | |
| ,latitude float | |
| ,longitude float | |
| ,date datetime | |
| ,reporttpye varchar(10) | |
| ,hourlyskyconditions varchar(10) | |
| ,hourlyvisibility int |
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 math | |
| def distance(origin, destination): | |
| lat1, lon1 = origin | |
| lat2, lon2 = destination | |
| radius = 6371 # km | |
| dlat = math.radians(lat2-lat1) | |
| dlon = math.radians(lon2-lon1) | |
| a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \ |
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 math | |
| def distance(origin, destination): | |
| lat1, lon1 = origin | |
| lat2, lon2 = destination | |
| radius = 6371 # km | |
| dlat = math.radians(lat2-lat1) | |
| dlon = math.radians(lon2-lon1) | |
| a = math.sin(dlat/2) * math.sin(dlat/2) + math.cos(math.radians(lat1)) \ |
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 tarfile as t | |
| import re | |
| import xml.etree.ElementTree as ET | |
| import fnmatch | |
| import os | |
| import sys | |
| import json | |
| class rect: |
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
| import xml.etree.ElementTree as ET | |
| from copy import deepcopy | |
| class Entry: | |
| def __init__(self,name,path=None,val=None): | |
| self.name=name | |
| self.path=path | |
| self.val=val | |
| def __str__(self): |