Python Stats

Great journey’s start with a single step. Here is a simple linear regression plot using python. Let’s see where this takes us.

import numpy as np
from numpy.polynomial.polynomial import polyfit
from scipy import stats
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv(“tntot-stats.csv”)
x = np.array(df[‘Pre-Roll’].values)
y = np.array(df[‘Mid-Roll’].values)

slope, intercept, r_value, p_value, std_err = stats.linregress(x,y)

print (slope, intercept, r_value, p_value)

# Fit with polyfit
b, m = polyfit(x, y, 1)

# print (“poly: “+str(m))

plt.plot(x, y, ‘.’)
plt.plot(x, b + m * x, ‘-‘)

plt.title(“Otto: Python Regression: Do TNTOT Pre-Rolls predict Midrolls?”)
plt.xlabel(‘Prerolls’)
plt.ylabel(‘Midrolls’)
plt.text(10000, 1200000,’Slope: ‘+str(round(slope,3)), ha=’left’, va=’center’)
plt.text(10000, 1100000,’Intercept: ‘+str(round(intercept,3)), ha=’left’, va=’center’)
plt.text(10000, 1000000,’R-squared: ‘+str(round(r_value,3)), ha=’left’, va=’center’)
plt.text(10000, 900000,’P-value: ‘+str(round(p_value,3)), ha=’left’, va=’center’)
plt.text(50000,400000, ‘Nov 2019 MTD’)
plt.text(50000,300000, ‘NBA.com TNTOT Desktop’)

plt.annotate(‘>95%’, xy=(30000, 1000000), xycoords=’data’,
xytext=(0.6, 0.75), textcoords=’axes fraction’,
arrowprops=dict(facecolor=’red’, shrink=0.05),
horizontalalignment=’right’, verticalalignment=’top’,
)


# plt.show() Need tkinter to have interactive
plt.savefig(“mpgraph.png”)

# plt.hist(x)
# plt.ylabel(‘No of times’)
# plt.savefig(“mpgraph2.png”)

Michael J. Pierce

C.S. Lewis

Lewis, grieving the death of his wife, Joy:

No one ever told me that grief felt so like fear. I am not afraid, but the sensation is like being afraid. The same fluttering in the stomach, the same restlessness, the yawning. I keep on swallowing.

At other times it feels like being mildly drunk, or concussed. There is a sort of invisible blanket between the world and me. I find it hard to take in what anyone says. Or perhaps, hard to want to take it in. It is so uninteresting. Yet I want the others to be about me. I dread the moments when the house is empty. If only they would talk to one another and not to me.

There are moments, most unexpectedly, when something inside me tries to assure me that I don’t really mind so much, not so very much, after all. Love is not the whole of a man’s life. I was happy before I ever met H. I’ve plenty of what are called ‘resources.’ People get over these things. Come, I shan’t do so badly. One is ashamed to listen to this voice but it seems for a little to be making out a good case. Then comes a sudden jab of red-hot memory and all this ‘commonsense’ vanishes like an ant in the mouth of a furnace.

From A Grief Observed
Compiled in A Year with C.S. Lewis

The most fun I’ve had at work

We use Slack at work. Because we’re all off in different places and working at different times, we use a channel to let everyone know where we’re at. This channel content grew to be announcements, and then group “Happy Birthdays” and more and more. Upper management decided it was “too much” and mandated only messages about location were to be posted.

So another channel was setup for “Happy Birthdays”. And then, because we shared youtube links for our favorite songs, another channel was setup. It was great. Some I liked, and wouldn’t have known about, if it weren’t for the channel. Classic songs that we all liked. Off-the-beaten songs. We shared and it was good. There was some small criticisms, and songs posted as a rebuttal to others, which just made it all the more fun.

But one day, a colleague posted Weezer covering A-ha doing “Take on Me.” Individually, harmless. But combined, egregious to the senses. I commented about it at lunch. We had previously commented on his penchant for Canadian music, including Rush. Someone suggested that he be banned from posting for 3 days. The laughter turned into a plot. We would petition the creator of the channel, whom we referred to as “The Commissioner” to ban him. On Count 1: Playing Canadian music, we were denied. Rush rocks. But on Count 2, The Weezer song, The Commissioner agreed. Egregious. The ban was issued and the individual was removed from the private channel.

Others protested this, one posted another Weezer song and he was immediately banned. This lead to further protests, like posting Nickleback songs. OMG I didn’t know they were Canadian. The Commissioner decided that showing some mercy was in order and issued this order: To commute the ban, the transgressors could post an American Flag emoticon in the FORBIDDEN CHANNEL upon which, we would all ‘Like” it.

The camaraderie and braveness of the Team, is the prime reason they are high performers.

I’m still laughing…