Merged
Conversation
The optimization achieves a **58x speedup** by eliminating the major performance bottleneck in pandas DataFrame processing. **Key optimizations:** 1. **Pre-fetch column data as numpy arrays**: The original code used `df.iloc[index][key]` for each cell access, which triggers pandas' slow row-based indexing mechanism. The optimized version extracts all column data upfront using `df[key].values` and stores it in a dictionary, then uses direct numpy array indexing `columns[key][index]` inside the loop. 2. **More efficient key validation**: Replaced the nested loop checking for missing keys with a single list comprehension `missing_keys = [key for key in REQUIRED_GANTT_KEYS if key not in df]`. 3. **Use actual DataFrame columns**: Instead of iterating over the DataFrame object itself (which includes metadata), the code now uses `list(df.columns)` to get only the actual column names. **Why this is dramatically faster:** - `df.iloc[index][key]` creates temporary pandas Series objects and involves complex indexing logic for each cell - Direct numpy array indexing `columns[key][index]` is orders of magnitude faster - The line profiler shows the original `df.iloc` line consumed 96.8% of execution time (523ms), while the optimized dictionary comprehension takes only 44.9% (4.2ms) **Performance characteristics:** - **Large DataFrames see massive gains**: 8000%+ speedup on 1000-row DataFrames - **Small DataFrames**: 40-50% faster - **List inputs**: Slight slowdown (3-13%) due to additional validation overhead, but still microsecond-level performance - **Empty DataFrames**: Some slowdown due to upfront column extraction, but still fast overall This optimization is most beneficial for DataFrame inputs with many rows, where the repeated `iloc` calls created a severe performance bottleneck.
Co-authored-by: Cameron DeCoster <cameron.decoster@gmail.com>
…e_gantt-mhcxyu68 ⚡️ Speed up function `validate_gantt` by 58x
- Check template.data.<trace_type> for marker.color or line.color before falling back to template.layout.colorway - Handle timeline special case (maps to bar trace type) - Use marker colors first, fall back to line colors if no markers found - Fixes issue #5416
- Modify apply_default_cascade to check template.data.<trace_type> for marker.color or line.color - Fallback to template.layout.colorway if trace-specific colors not found - Add comprehensive tests for trace-specific color sequences - Handle timeline special case (maps to bar trace type) - Follow existing patterns for symbol_sequence and line_dash_sequence Fixes #5416
- Modify apply_default_cascade to read colors from template.data.<trace_type> - Prioritize trace-specific colors over layout.colorway - Add special case for timeline constructor (maps to bar trace type) - Add comprehensive tests for trace-specific color sequences - Test trace type isolation, fallback behavior, and timeline special case
…plates fix: Update GitHub issue templates
- Make constructor parameter required (was optional with None default) - Refactor trace-specific color extraction to only assign when colors are found - Improve code clarity by checking for non-empty color list before assignment
- Remove redundant check that was setting color_discrete_sequence to None - The check is unnecessary since we only assign trace_specific_colors when any() is True - Fallback logic to layout.colorway and qualitative.D3 remains intact
Co-authored-by: Emily KL <4672118+emilykl@users.noreply.github.com>
[Fix] Support trace-specific color sequences in Plotly Express via templates
Merge doc prod to main branch
Update example to use geodatasets
write_image() defaulted engine='auto' and passed it to to_image(), which treats any non-None engine value as explicitly user-specified and emits a deprecation warning. By defaulting to None (matching to_image's expected interface), the warning only appears when the user actually passes an engine argument. Fixes #5512
…-warning Fix spurious engine deprecation warning in write_image
Co-authored-by: Emily KL <4672118+emilykl@users.noreply.github.com>
upgrade plotly.js to v3.4.0
Docs for 6.6
Release v6.6.0
Update docs to latest plotly.py version
Update API reference doc version
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.