Question: I am getting error while trying this code: # 8. Using the object-oriented interface method, plot the resample DataFrame using the df.plot() function. # Import
I am getting error while trying this code:
# 8. Using the object-oriented interface method, plot the resample DataFrame using the df.plot() function. # Import the style from Matplotlib. from matplotlib import style # Use the graph style fivethirtyeight. style.use('fivethirtyeight') JanMay_weekly_farextype.plot(figsize=(12, 10)) plt.title('Weekly Fares by City Type') plt.ylabel('Fare ($USD)') plt.xlabel('') plt.subplots_adjust(bottom=0.15)
ValueError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_177844\2149522325.py in----> 1 JanMay_weekly_farextype.plot(figsize=(12, 10)) 2 3 plt.title('Weekly Fares by City Type') 4 plt.ylabel('Fare ($USD)') 5 plt.xlabel('') ~\anaconda3.1\envs\PythonData\lib\site-packages\pandas\plotting\_core.py in __call__(self, *args, **kwargs) 970 data.columns = label_name 971 --> 972 return plot_backend.plot(data, kind=kind, **kwargs) 973 974 __call__.__doc__ = __doc__ ~\anaconda3.1\envs\PythonData\lib\site-packages\pandas\plotting\_matplotlib\__init__.py in plot(data, kind, **kwargs) 69 kwargs["ax"] = getattr(ax, "left_ax", ax) 70 plot_obj = PLOT_CLASSES[kind](data, **kwargs) ---> 71 plot_obj.generate() 72 plot_obj.draw() 73 return plot_obj.result ~\anaconda3.1\envs\PythonData\lib\site-packages\pandas\plotting\_matplotlib\core.py in generate(self) 286 self._compute_plot_data() 287 self._setup_subplots() --> 288 self._make_plot() 289 self._add_table() 290 self._make_legend() ~\anaconda3.1\envs\PythonData\lib\site-packages\pandas\plotting\_matplotlib\core.py in _make_plot(self) 1197 # TODO: GH28021, should find a way to change view limit on xaxis 1198 lines = get_all_lines(ax) -> 1199 left, right = get_xlim(lines) 1200 ax.set_xlim(left, right) 1201 ~\anaconda3.1\envs\PythonData\lib\site-packages\pandas\plotting\_matplotlib\tools.py in get_xlim(lines) 481 for line in lines: 482 x = line.get_xdata(orig=False) --> 483 left = min(np.nanmin(x), left) 484 right = max(np.nanmax(x), right) 485 return left, right <__array_function__ internals> in nanmin(*args, **kwargs) ~\anaconda3.1\envs\PythonData\lib\site-packages umpy\lib anfunctions.py in nanmin(a, axis, out, keepdims) 317 # Fast, but not safe for subclasses of ndarray, or object arrays, 318 # which do not implement isnan (gh-9009), or fmin correctly (gh-8975) --> 319 res = np.fmin.reduce(a, axis=axis, out=out, **kwargs) 320 if np.isnan(res).any(): 321 warnings.warn("All-NaN slice encountered", RuntimeWarning, ValueError: zero-size array to reduction operation fmin which has no identity
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
