Bayesian analysis example – switchpoint detection

Here, we will try to use Bayesian inference and model an interesting dataset. The dataset in question consists of the author's Facebook (FB) post history over time. We have scrubbed the FB history data and saved the dates in the fb_post_dates.txt file. Here is what the data in the file looks like:

    head -2 ../fb_post_dates.txt 
    Tuesday, September 30, 2014 | 2:43am EDT
    Tuesday, September 30, 2014 | 2:22am EDT

Thus, we see a datetime series, representing the date and time at which the author posted on FB. First, we read the file into DataFrame, separating the timestamp into Date and Time columns:

 In [91]: filePath="./data/fb_post_dates.txt" fbdata_df=pd.read_csv(filePath, sep='|', parse_dates=[0], ...

Get Mastering pandas - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.