<jupyter_start><jupyter_text>Links[Python Strings](https://www.tutorialspoint.com/python/python_strings.htm)[Tutorials Point](https://www.tutorialspoint.com/python/python_strings.htm)[](https://realpython.com/python-data-cleaning-numpy-pandas/) https://realpython.com/python-data-cleaning-numpy-pandas/https://pbpython.com/excel-pandas-comp.htmlhttps://pandas.pydata.org/pandas-docs/stable/user_guide/reshaping.htmlhttps://techcommunity.microsoft.com/t5/excel/date-formatting-in-a-pivot-table/m-p/212645<jupyter_code>from bs4 import BeautifulSoup
import numpy as np
import pandas as pd
file_path = '/home/prp1277/Github-Repos/finance/venv/src/data/Account_Robinhood.html'
#class_id = '._3NMzU5fXznQpBLKHCzCnmY _2t9VpreyfrBfaRwT9RLyoz'

f = open(file_path, 'r')
soup = BeautifulSoup(f)
H3s = soup.findAll("h3")

for i in H3s:
    print(i.text)
print(len(H3s))
df3 = pd.DataFrame.from_records(H3s)
H3s<jupyter_output><empty_output><jupyter_text>H3s is a set containing 450 lines of transactions<jupyter_code>transactions = list(H3s)

for i in transactions:
    print(i.text.split('\n'))
df = pd.DataFrame({'col':transactions})
df
df2 = pd.DataFrame({'transaction': H3s})
df2
csv_file = open('/home/prp1277/Github-Repos/finance/venv/src/data/transactions.csv',"r")
csv_data = csv_file.readlines()

for i in csv_data:
    lines = (i.splitlines())
    print(i.split(';'))<jupyter_output>['Transaction', 'Date', 'Result', 'Details', '\n']
['Dividend from Microsoft', 'Mar 12, 2020', '+$8.16', '\n']
['Disney Limit Sell', 'Mar 9, 2020', 'Canceled', '\n']
['Twitter Limit Sell', 'Mar 9, 2020', 'Canceled', '\n']
['Deposit from Core Bank', 'Mar 6, 2020', '+$50.00', '\n']
['Deposit from Core Bank', 'Feb 28, 2020', '+$50.00', '\n']
['Virgin Galactic Holdings Market Buy', 'Feb 24, 2020', '$128.59', '4 shares at $32.15', '\n']
['Deposit from Core Bank', 'Feb 24', '+$50.00', '\n']
['Chewy Market Buy', 'Feb 21, 2020', '$763.44', '25 shares at $30.54', '\n']
['Virgin Galactic Holdings Limit Buy', 'Feb 20, 2020', '$950.00', '25 shares at $38.00', '\n']
['Virgin Galactic Holdings Limit Buy', 'Feb 20, 2020', 'Canceled', '\n']
['Virgin Galactic Holdings Stop Loss Sell', 'Feb 20, 2020', '$900.00', '25 shares at $36.00', '\n']
['Disney Market Sell', 'Feb 20, 2020', '$704.00', '5 shares at $140.80', '\n']
['Disney Market Sell', 'Feb 19, 2020', 'Canceled', '\n']
['Twitter Limit Sell', 'Feb 1[...]<jupyter_text>Enough Is Enough Convert Data Using PowerShell`get-content robinhood_transactions.csv | convertfrom-csv | convertto-json | Out-file robinhood_transactions.json`<jupyter_code>json_file = pd.read_json('/home/prp1277/Github-Repos/finance/venv/src/data/robinhood_transactions.json',convert_dates=True)
json_file<jupyter_output><empty_output><jupyter_text>Split the Details & Transactions ColumnsIn Transactions we want to know whether it was a buy or a sell and in the Details column we want to know how many at what price.> [Source Article](https://realpython.com/python-data-cleaning-numpy-pandas/)<jupyter_code>detail_string = str(json_file["Detail"])
new_lines = detail_string.split('\n')
shares = json_file['Detail'].str.extract(r'^(\d{2})', expand=False)
shares
price = json_file['Detail'].str.split()<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.18089053803339517, 'fraction_numerical': 0.05627705627705628, 'mean_word_length': 5.882978723404255, 'pattern_counts': {'":': 0, '<': 16, '<?xml version=': 0, '>': 17, 'https://': 8, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '32510', 'license': 'MIT', 'n_tokens_mistral': 1379, 'n_tokens_neox': 1207, 'n_words': 267, 'path': 'venv/src/Notebooks/RobinhoodTransactions.ipynb', 'repo_name': 'prp1277/finance', 'size': '3234'}