Tags » Histogram

Central Limit Theorem

Final code:

import numpy as np
import matplotlib.pyplot as plt

mu, sigma = 0, 0.1
pop_normal = np.random.normal(mu, sigma, 10000000)

print 'Population Mean:', np.mean(pop_normal)

bins = 15
plt.figure(1)
plt.suptitle('Distribution of population', fontsize=16)
plt.hist(pop_normal, bins = bins)
plt.xlabel('Values')
plt.ylabel('Frequency')
plt.savefig('Popula.jpg')

print 'Random sample:', pop_normal

for i in range(10):
	print i+1, '. 2,041 more words

Smells Like Another Graph

Wasn’t sure how hard this was going to be, but it was very easy. I mentioned this in the last post, and here it is. It is most typical for there to be 2 years between releases.

Heavy Metal

Band Release Activity

I’ve made some attempts to figure out what is going on with band activity and album releases to see if I can figure out why it looks like metal is dying and people aren’t forming new bands. 544 more words

Heavy Metal

Troubling

Another project I came across while researching this project had done a decent job of doing some plots very similar to, and in many cases inspiring, things I’ve been plotting. 335 more words

Heavy Metal

Plotting, plotting and plotting

Final code:

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt

df = pd.read_csv('companies.csv')
print df.shape
print df.info()
print df.describe()

df = df < 9000]

bins = np.arange(df['Renewal fee'].min(), df['Renewal fee'].max()+600, 500)

plt.figure(1)
plt.subplot(121)
plt.boxplot(df['Renewal fee'])
plt.title('Revenues - boxplot')

plt.subplot(122)
plt.hist(df['Renewal fee'], bins = bins, alpha = 0.7, color = '#112299', edgecolor = 'w')
plt.grid(True, linestyle = '--', alpha = 0.6)
plt.title('Revenues - histogram')
plt.savefig('Revenues.jpg')

df = df.drop('GOC code', 1)
df = df.drop('Company _name', 1)

df.loc == 'Cliare', 'CA'] = 'Claire'

months = {'1': 'January', '2': 'February', '3': 'March', '4': 'April', '5': 'May',
            '6': 'June', '7': 'July', '8': 'August', '9': 'September', '10': 'October', '11': 'November', '12': 'December'}

df['Renewal date'].replace(months, inplace = True)

month_unique = df['Renewal date'].unique()
revenue = []
clients_per_month = []

months_reverse = {'January': '1', 'February': '2', 'March': '3', 'April': '4', 'May': '5',
            'June': '6', 'July': '7', 'August': '8', 'September': '9', 'October': '10', 'November': '11', 'December': '12'}

#Sorting the month names in order using the 'months_reverse' dictionary
month_unique = sorted(month_unique, key=lambda x: months_reverse [x])

#Adding the monthly totals to the revenue list
for el in month_unique:
   revenue.append(df.loc == el, 'Renewal fee'].sum())

#Adding the number of clients by month to the list
for el in month_unique:
    clients_per_month.append(len(df == el]))

plt.figure(2)
plt.subplot(121)
xs = np.arange(len(month_unique))
plt.xticks(np.arange(len(month_unique)), month_unique)
plt.plot(xs, revenue, alpha = 0.7, color = 'g')
plt.grid(True, linestyle = '--', alpha = 1)
plt.title('Revenue per month')

plt.subplot(122)
xs = np.arange(len(month_unique))
plt.xticks(np.arange(len(month_unique)), month_unique)
plt.plot(xs, clients_per_month, alpha = 0.7, color = 'g')
plt.grid(True, linestyle = '--', alpha = 1)
plt.title('Renewals per month')
plt.savefig('Per_month.jpg')

… 1,293 more words

Histogram Shrink in Matlab

Image Histogram is a graphical representation of the gray level distribution in an Image.

Follow these steps to make Program for shrinking the range of Gray Level in Image… 848 more words

Matlab