-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PerformanceWarning: DataFrame is highly fragmented #340
Comments
Hello @mikeperalta1, I am aware of the from warnings import simplefilter
simplefilter(action="ignore", category=pd.errors.PerformanceWarning) It occurs when you are appending a Pandas DataFrame to an existing Pandas DataFrame. They recommend using In Pandas TA, it occurs in the internal method @pd.api.extensions.register_dataframe_accessor("ta")
class AnalysisIndicators(BasePandasObject):
# ...
def _append(self, result=None, **kwargs) -> None:
# ... Furthermore, I have already tried to use Lines 416 to 418 in 1deb755
which is generating this PW. Now this is either a Pandas bug or I am coding Hope this helps! Kind Regards, |
@twopirllc Thank you for that thorough explanation! I suppose for now I will simply mute the warning. |
any fix to this issue? i have the same problem :( |
Which Pandas TA version are you running? It has already been silenced in version 0.3.14b. If you are concating yourself, then you need to apply the simplefilter for your situation. As you know, it's under Pandas care so stay abreast with the discussion in Pandas Issue 42477 Kind Regards, |
What if you are not even using the "import pandas as pd" and you still get the error? |
Well , If you dont import pandas as pd , You could try this -
|
Which version are you running? The lastest version is on Github. Pip is for major releases.
0.3.2b0
Upgrade.
I appear to be running the latest (?)
Describe the bug
When adding technical indicators to an existing data frame, I receive the following warning:
These warnings are reduced when I implement the suggestion of
newframe = frame.copy()
, but not eliminated. I believe fragmentation is happening during pandas-ta calls, but I can't tell for sure because there is no trace.To Reproduce
I start with a DataFrame populated with just the right columns for pandas-ta. Then add technical indicators like so:
I'm not sure whether the warnings come from the SMA indicator. I'm adding SMA, EMA, MACD, STOCH, RSI, ADX, CCI, AROON, BBANDS, the ta.cmf one (Chaikin's AD??), and OBV
Expected behavior
No warnings or excessive fragmentation during the computations.
Screenshots
N/A
Additional context
pandas: 1.3.0
pandas-ta: 0.3.2b0
python: 3.9.6
numpy: 1.21.0
Thanks for using Pandas TA!
The text was updated successfully, but these errors were encountered: