| import os |
| import requests |
|
|
| os.makedirs('data', exist_ok=True) |
|
|
| url = "https://huggingface.co/datasets/David-Egea/Creditcard-fraud-detection/resolve/main/creditcard.csv" |
|
|
| print("Downloading creditcard.csv...") |
| response = requests.get(url, stream=True) |
| response.raise_for_status() |
|
|
| with open('data/creditcard.csv', 'wb') as f: |
| for chunk in response.iter_content(chunk_size=8192): |
| f.write(chunk) |
|
|
| print("Download complete!") |
| import pandas as pd |
| df = pd.read_csv('data/creditcard.csv') |
| print(f"Rows: {len(df)}, Fraud: {df['Class'].sum()}") |