<jupyter_start><jupyter_text>Hamming Distance  Hamming distance between two vectors is simply the sum of corresponding elements that differ between the vectors.<jupyter_code>import numpy as np
from scipy.spatial.distance import hamming

import warnings
warnings.filterwarnings("ignore") 

# yfinance is used to fetch data 
import yfinance as yf
yf.pdr_override()
symbol = 'AMD'

start = '2018-01-01'
end = '2019-01-01'

# Read data 
dataset = yf.download(symbol,start,end)

# View Columns
dataset.head()
dataset.tail()
dataset = dataset.drop(['Adj Close', 'Volume'], axis=1)
dataset.head()
def hamming_distance(x, y):

    hamming_d = hamming(x, y) * len(x)
    return hamming_d
Open = np.array(dataset['Open'])
Close = np.array(dataset['Close'])
Open
Close
hamming_distance(Open, Close)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11627906976744186, 'fraction_numerical': 0.0208078335373317, 'mean_word_length': 5.650406504065041, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '360406', 'license': 'MIT', 'n_tokens_mistral': 293, 'n_tokens_neox': 275, 'n_words': 77, 'path': 'Python_Stock/Apply_Mathematics_Trading_Investment/Hamming_Distance_Stock.ipynb', 'repo_name': 'chunsj/Stock_Analysis_For_Quant', 'size': '817'}