i try to test my code and i have 2 different problems:
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_children’
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_xlabel’
i think the problem is the version of matplotlib, or maybe the test code is old? https://freecodecam-boilerplate-c7emtcc2lf6.ws-eu120.gitpod.io/
my code is here.
Your code so far
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36
Challenge Information:
Data Analysis with Python Projects - Medical Data Visualizer
Traceback (most recent call last):
File “/workspace/boilerplate-medical-data-visualizer/test_module.py”, line 26, in test_bar_plot_number_of_bars
actual = len([rect for rect in self.ax.get_children() if isinstance(rect, mpl.patches.Rectangle)])
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_children’
Traceback (most recent call last):
File “/workspace/boilerplate-medical-data-visualizer/test_module.py”, line 13, in test_line_plot_labels
actual = self.ax.get_xlabel()
AttributeError: ‘numpy.ndarray’ object has no attribute ‘get_xlabel’
I went through the error, and it seems the test code expects a single Axes object but is receiving a NumPy ndarray of Axes instead. To fix this, you should extract a single Axes from the array or from the facetgrid before calling .get_children() or .get_xlabel(). This is not an issue with the matplotlib version, but rather a usage mismatch. Let us know if this works. Good Luck!