-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
QST: DataFrame with freq of 2.5ms fails to plot #41064
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
Comments
It works when plotting directly to
|
As you said the code below runs as expected
However,
fails due out of RAM looks like a backend of pandas in core. PD: Outside jupyter works as expected. Out of RAM occurs here
|
Thanks for reporting this @phollox-arch, investigations to look into why this happens would be great! |
I can replicate the problem. Here are more information to look into it: import pandas as pd
df = pd.read_csv('p85.csv', index_col="date", parse_dates=True)
df.plot() # super slow ???
# now I cast to seconds via strftime
df.index = [pd.to_datetime(df.index[i].strftime("%Y-%m-%d %H:%M:%S")) for i in range(len(df.index))]
# now the plot is blazing fast !
df.plot() here is the .csv to replicate: Here on my laptop it takes 20s to plot these 5 values and if I want to plot However doing this works around the problem pd.plotting.plot_params["x_compat"] = True Hope this helps someone to look into it 🙏 |
[ X] I have searched the [pandas] tag on StackOverflow for similar questions.
[X ] I have asked my usage related question on StackOverflow. Here: https://stackoverflow.com/questions/67183791/pandas-dataframe-with-time-index-and-freq-with-multiplier
Question about pandas
I have a DataFrame with a time series as index.
When I put a multiplier on the frequency, it becomes extremely slow to plot
df2
, even if it has less elements thandf
. It actually crashed my Python kernel, and my laptop almost ran out of RAMTrying with
freq=2500U
does not make any differenceI was wondering if this behavior is normal. Haven't tried to run this on a code profiler. Or with any other algorithms, to see if has any effect.
Thanks
Python 3.9.3-1,
Pandas 1.2.3-1,
Numpy 1.20.1-1,
Matplotlib 3.4.1-2
The text was updated successfully, but these errors were encountered: