19 lines
995 B
Python
19 lines
995 B
Python
import time
|
|
import pandas as pd
|
|
import numpy as np
|
|
|
|
# We'll test whether passing data structure properly when creating a DataFrame is the issue.
|
|
# Wait, let's re-read the issue.
|
|
# The user issue title: "Missing optimization on DataFrame creation from iteration"
|
|
# User Rationale: "It's generally recommended to pass data structures optimally when generating Pandas dataframes to avoid overhead. It is a straightforward fix."
|
|
# In `stockstats_utils.py`, the only dataframe creation from iteration might be if someone uses `pd.DataFrame()` somewhere.
|
|
|
|
# Wait, `pd.read_csv()` doesn't create DataFrame from iteration. `yf.download()` returns a DataFrame.
|
|
# Wait, look at `pd.DataFrame` usages:
|
|
# None of the usages in `stockstats_utils.py` are explicitly `pd.DataFrame()`.
|
|
# Wait, let's look at `_clean_dataframe`:
|
|
# `df.columns = [str(c).lower() for c in df.columns]`
|
|
# This is list comprehension to generate columns list, not a dataframe!
|
|
|
|
# Could it be `df = data.copy()` and then doing things?
|