I get ValueError: microsecond must be in 0..999999
when I try to plot two series using scatter plot.
I have two datasets(contains the posts made on a platform with the time they where created and number of comments each post receiced) the goal here is to understand what time if a post was created it will likely create a big number of comments.
hn_ask_sorted_data = hn_ask_data.sort_values(by = ['num_comments'],ascending=False)
hn_show_sorted_data = hn_show_data.sort_values(by = ['num_comments'],ascending=False)
hn_ask_sorted_data['created_at'] = pd.to_datetime(hn_ask_sorted_data['created_at'])
hn_show_sorted_data['created_at'] = pd.to_datetime(hn_show_sorted_data['created_at'])
I convert the column that contains time into a datetime object, but I am more interested with the time component of the object hence I only take the time component using the .dt.time
hn_ask_sorted_data['created_at'] = hn_ask_sorted_data['created_at'].dt.time
hn_show_sorted_data['created_at'] = hn_show_sorted_data['created_at'].dt.time
Then I make a scatterplot using two columns one containing number of comments on the post and the time during which the post was posted (ie the above created column) instead of getting the results I get the described error.
plt.scatter(hn_ask_sorted_data['created_at'],hn_ask_sorted_data['num_comments'])
plt.show()
plt.scatter(hn_show_sorted_data['created_at'],hn_show_sorted_data['num_comments'])
plt.show()