<jupyter_start><jupyter_text>Analysis of scraped data Stored in file "calvinComicsData.txt"<jupyter_code>fav = []
comment = []
like = []
dates = []

maxLikeFav = 0
maxLikeFavURL = ""

minTotal = 1000
leastInteractionURL = ""

leastFavoriteURL = ""
minFav = 1000
leastLikedURL = ""
minLike = 1000
leastCommentedURL = ""
minComment = 1000

for line in open("calvinComicsData.txt", "r"):
    lineData = line.split(',')
    URL = lineData[0]
    if( URL != "URL" ):
        f = int(lineData[1])
        c = int(lineData[2])
        l = int(lineData[3])
        if( f < minFav ):
            minFav = f
            leastFavoriteURL = URL
        if( c < minComment):
            minComment = c
            leastCommentedURL = URL
        if( l < minLike ):
            minLike = l
            leastLikedURL = URL
        if( l + c + f < minTotal ):
            minTotal = l+c+f
            leastInteractionURL = URL
        if( l/f > maxLikeFav ):
            maxLikeFav = l/f
            maxLikeFavURL = URL
        fav.append(f)
        comment.append(c)
        like.append(l)
        dateData = lineData[0].split('/')   # http(0) / (1) / gocomics (2) / calvin (3) / year(4) / month(5) / day (6)
        dates.append( date(int(dateData[4]), int(dateData[5]), int(dateData[6])))    

print("Least Favorited: %s" %(leastFavoriteURL) )
print("Least Commented: %s" %(leastCommentedURL) )
print("Least Liked: %s" %(leastLikedURL) )
print("Least Everything: %s" %(leastInteractionURL) )
print("Max Like/Fav ratio: %s" %(maxLikeFavURL) )
myFmt = mdates.DateFormatter('%Y')

plt.figure(num=None, figsize=(10, 6), dpi=80, facecolor='w', edgecolor='k')

ax = plt.subplot(311)
ax.plot(dates,fav, "b-", label="favorites")
plt.title("Calvin and Hobbes comic statistics")
plt.ylabel('Favorited')
ay = plt.subplot(312)
ay.plot(dates,comment, "g-", label="comments" )
plt.ylabel('Comments')
az = plt.subplot(313)
az.plot(dates,like, "r-", label="likes")
plt.ylabel('Likes')
az.xaxis.set_major_formatter(myFmt)

plt.xlabel('Date')
plt.tight_layout()
plt.show()
from scipy.stats.stats import pearsonr
result = pearsonr(fav, like)
print(result)

import numpy
myFmt = mdates.DateFormatter('%Y')

plt.figure(num=None, figsize=(10, 6), dpi=80, facecolor='w', edgecolor='k')

ax = plt.subplot(211)
ax.plot(dates, fav,"b-", label="favorites")
plt.title("Calvin and Hobbes comic statistics")
plt.ylabel('Favorited')


#ay = plt.subplot(412)
#ay.plot(dates,comment, "g-", label="comments" )
#plt.ylabel('Comments')
#az = plt.subplot(413)
#az.plot(dates,like, "r-", label="likes")
#plt.ylabel('Likes')
#az.xaxis.set_major_formatter(myFmt)
plt.xlabel('Date')

aa = plt.subplot(212)
# fav is array of values containing integer # favorited
y = fav - numpy.mean(fav)
norm = numpy.sum(y ** 2)
correlated = numpy.correlate(y, y, mode='full')/norm
aa.plot(correlated)
plt.ylabel('Autocorrelation')


plt.tight_layout()
plt.show()
numpy.where(correlated==0.51)
numpy.where(correlated==0.5)
for i in range(len(correlated) ):
    if( correlated[i] > 0.49 and correlated[i] < 0.51 ):
        print(i)
3715 - 3675<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16924564796905223, 'fraction_numerical': 0.02675693101225016, 'mean_word_length': 3.624441132637854, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '304502', 'license': 'MIT', 'n_tokens_mistral': 1261, 'n_tokens_neox': 1177, 'n_words': 238, 'path': 'Online Comics Analysis.ipynb', 'repo_name': 'murfrosoft/webscraping', 'size': '3102'}