Skip to content
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

fix: suppress pandas tick resolution adjustment #1635

Merged
merged 8 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/ydata_profiling/visualisation/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,6 +592,7 @@ def plot_timeseries_gap_analysis(
label=label,
color=color,
alpha=0.65,
x_compat=True,
)
_format_ts_date_axis(serie, ax)
ax.yaxis.set_major_locator(MaxNLocator(integer=True))
Expand Down Expand Up @@ -677,11 +678,11 @@ def _plot_timeseries(
colors = create_comparison_color_list(config)

for serie, color, label in zip(series, colors, labels):
ax = serie.plot(color=color, label=label, alpha=0.75)
ax = serie.plot(color=color, label=label, alpha=0.75, x_compat=True)
_format_ts_date_axis(serie, ax)

else:
ax = series.plot(color=config.html.style.primary_colors[0])
ax = series.plot(color=config.html.style.primary_colors[0], x_compat=True)
_format_ts_date_axis(series, ax)

return plot
Expand Down
27 changes: 27 additions & 0 deletions tests/issues/test_issue1631.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
"""
Test for issue 1631:
https://github.com/ydataai/ydata-profiling/issues/1631
"""
import pandas as pd

from ydata_profiling import ProfileReport


def test_issue1631(test_output_dir):
data = {
"value": [1, 2, 3, 4],
"datetime": [
"2022-10-01 00:10:00",
"2022-10-02 00:20:00",
"2022-10-03 00:30:00",
"2022-10-04 00:40:00",
],
}
df = pd.DataFrame(data)
df["datetime"] = pd.to_datetime(df["datetime"], errors="raise")
df.set_index("datetime", inplace=True)
profile = ProfileReport(df, tsmode=True)
output_file = test_output_dir / "issue1631.html"
profile.to_file(output_file)

assert output_file.exists()
Loading