
Answer-first summary for fast verification
Answer: plotting.max_rows
The correct answer is **B. plotting.max_rows**. This option specifically limits the number of rows shown in visualizations such as bar and pie charts, ensuring that plots remain clear and manageable, especially with large datasets. - **A. compute.default_index_type**: This option relates to the default index type for new DataFrames, not visualization settings. - **C. compute.shortcut_limit**: Governs the maximum rows collected to the driver for certain operations, unrelated to plotting. - **D. compute.ops_on_diff_frames**: Controls operations on DataFrames with differing indexes, again not pertinent to plotting. **Example Usage**: ```python import pandas as pd # Adjust the visual row limit pd.set_option('plotting.max_rows', 20) # Generate a DataFrame df = pd.DataFrame({'A': [1, 2, 3, 4, 5], 'B': [5, 4, 3, 2, 1]}) # Display a bar chart, limited to the top 20 rows df.plot.bar() ``` **Key Takeaways**: - Modifying `plotting.max_rows` aids in reducing plot clutter and enhancing interpretability. - It also optimizes performance by restricting the data volume processed for visualizations. - Current settings can be verified with `pd.get_option('plotting.max_rows')`.
Author: LeetQuiz Editorial Team
Ultimate access to all questions.
No comments yet.