Skip to content
Cleaning Stripe csv
# Start coding here...
import pandas as pd
x="Itemized_balance_change_from_activity_EUR_2025-04-10_to_2025-04-21_UTC.csv"
y='Itemized_payouts_payout_EUR_2025-04-10_to_2025-04-21_UTC.csv'
text = pd.read_csv(x, index_col='balance_transaction_id')
textpayout = pd.read_csv(y, index_col='balance_transaction_id')
#incoming transactions processing
text.created = text.created.str[:10]
text.fee = -1 * text.fee
text = text.drop('available_on', axis=1)
text = text.drop('net', axis=1)
text2 = text.copy()
text2.gross = text2.fee
text2.reporting_category = "fee"
text = text.drop('fee', axis=1)
text2 = text2.drop('fee', axis=1)
#payout transactions processing
textpayout.effective_at = textpayout.effective_at.str[:10]
textpayout.description = "transfer to bank account"
textpayout = textpayout.rename(columns={'effective_at':'created'})
textpayout.gross = -1 * textpayout.gross
text3 = textpayout[['created', 'currency', 'gross', 'reporting_category', 'description']]
#forming the final file
text = pd.concat([text, text2, text3])
#text = pd.concat([text, text2])
print(text.describe)
text4 = text.loc[text.gross != 0]
text4.to_csv('statement3.csv')
print(text4.describe)