This file contains 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/local/bin/python3 | |
import operator | |
import pandas as pd | |
import numpy as np | |
from scipy import spatial | |
def ComputeDistance(a, b): | |
dataA = a[1] | |
dataB = b[1] |
This file contains 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
""" | |
module to convert the strings to either lowercase or uppercase | |
""" | |
def to_lowercase(given_strings): | |
""""convert given strings to lower case""" | |
return given_strings.lower() | |
def to_uppercase(given_strings): | |
""""convert given strings to upper case""" |
This file contains 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
"""crud module""" | |
import pymysql.cursors | |
def connection(): | |
""" | |
function to establish connection with the database | |
""" | |
SERVER_URL = "localhost" |
This file contains 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
"""crud module""" | |
import pymysql.cursors | |
def connection(): | |
""" | |
function to establish connection with the database | |
""" | |
SERVER_URL = "localhost" |
This file contains 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 firebase_admin | |
from firebase_admin import credentials | |
from firebase_admin import firestore | |
# Use a service account | |
cred = credentials.Certificate('serviceAccountKey.json') | |
firebase_admin.initialize_app(cred) | |
db = firestore.client() |
This file contains 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 docx import Document | |
time_and_date = "2019-10-21" | |
employee_name = "John Smith" | |
manager_name = "Michelle Johnson" | |
department_name = "HR Department" | |
save_filename = employee_name + "_recognition_letter_drafted.docx" | |
document = Document('recognition_letter_template.docx') |
This file contains 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/local/bin/python3 | |
import operator | |
import pandas as pd | |
import numpy as np | |
from scipy import spatial | |
r_cols = ['user_id', 'movie_id', 'rating'] | |
ratings = pd.read_csv('ml-100k/u.data', sep='\t', names=r_cols, usecols=range(3)) |
This file contains 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
# using dask to handle the big dataset | |
import dask.dataframe as dd | |
# use numpy to conver the dask dataframe object to array object | |
import numpy as np | |
# load the dataset file | |
file_name = 'sample_data_set.csv' | |
#row_count to output |
This file contains 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 random | |
r_size = int(10) # set the number of times you want to iterate | |
file_name = "sample_output_to_csv.csv" # file name to be used when saving as CSV file | |
# file_string value below will be stored as the first line in the CSV file | |
# first line is usually the header row | |
file_string = "UID,NUM_VALUE,NOTES\n" |
This file contains 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
def foo(): | |
a = 'test' | |
return a |