Data Analysis with Python Projects - Page View Time Series Visualizer

Tell us what’s happening:
Describe your issue in detail here.
I am experiencing this error,any help

…E/home/runner/boilerplate-page-view-time-series-visualizer/venv/lib/python3.8/site-packages/pandas/plotting/_matplotlib/ MatplotlibDeprecationWarning:
The epoch2num function was deprecated in Matplotlib 3.5 and will be removed two minor releases later. Use date2num(datetime.utcfromtimestamp(e))<.date2num> instead.
base = dates.epoch2num(dt.asi8 / 1.0e9)

ERROR: test_data_cleaning (test_module.DataCleaningTestCase)

Traceback (most recent call last):
File “/home/runner/boilerplate-page-view-time-series-visualizer/”, line 7, in test_data_cleaning
actual = int(time_series_visualizer.df.count(numeric_only=True))
File “/home/runner/boilerplate-page-view-time-series-visualizer/venv/lib/python3.8/site-packages/pandas/core/”, line 112, in wrapper
raise TypeError(f"cannot convert the series to {converter}")
TypeError: cannot convert the series to <class ‘int’>

Ran 11 tests in 8.657s

FAILED (errors=1)

Your code so far
My Code

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/103.0.5060.134 Safari/537.36

Challenge: Data Analysis with Python Projects - Page View Time Series Visualizer

Link to the challenge:

The error says it can’t convert something to int and gives you the code causing the problem. The first step is to print the thing you are trying to convert to int, in this case, time_series_visualizer.df.count(numeric_only=True). If you don’t want to modify the tests, you can go into your code and print df.count(numeric_only=True) in your data cleaning code, assuming your dataframe is called df. You should then see what is trying to be converted to int and hopefully get insight into how to fix that.

Since your code didn’t post, there’s not much more to discuss. We will need your code to debug further. It’s easier to just post a link to your

@jeremy.a.gray I have tried to paste the link severally but its not showing let me try posting screenshot of the code instead

So, I forked your code and did exactly as I described earlier and got output like:

value    1238
dtype: int64
.......value    1238
month    1238
year     1238
dtype: int64


value    1238
dtype: int64

coming from your data cleaning and

value    1238
month    1238
year     1238
dtype: int64

coming from the failing test, which makes sense since that is an iterable and not something that can be made into an int.

So, you need to track down the only place you’re adding a month and a year to the dataframe and follow the comment there:

    # Copy and modify data for monthly bar plot

You’re modifying, but you don’t copy until after you modify.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.