Created
July 9, 2025 08:41
-
-
Save killerbytes/dd016b0769ea90c305216e732a7c2ef7 to your computer and use it in GitHub Desktop.
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 codecs | |
import pandas as pd | |
def start(): | |
doc = codecs.open("import.csv", "r", "utf-8") | |
df = pd.read_csv(doc, sep=',') | |
df = df[(df['Type'] == 'BUY') | (df['Type'] == 'SELL')] | |
df = df.drop(columns=['Description', 'Currency', 'Type', 'Amount' ]) | |
df['Date'] = pd.to_datetime(df['Date']) | |
df['Stock'] = df['Stock'] + ".PH" | |
df = df.rename(columns={'Stock': 'Ticker', 'Price': 'Cost Per Share', 'Comm & Other Fees': 'Commission'}) | |
df.to_csv('export.csv', index=False,) | |
start() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment