Skip to content

Commit

Permalink
added pands first tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
learnp committed Jan 21, 2017
1 parent d56d563 commit 72565f9
Show file tree
Hide file tree
Showing 27 changed files with 2,638 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.pyc
.idea/
**/.idea/
.ipynb_checkpoints/
**/.ipynb_checkpoints/
**/.cache/
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .idea/py.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions Advanced/decorators.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import time
def time_it(func):
def wrapper(*args, **kwargs):
start = time.time()
result = func(*args,**kwargs)
end = time.time()
print(func.__name__ +" took " + str((end-start)*1000) + "mil sec")
return result
return wrapper

@time_it
def calc_square(numbers):
result = []
for number in numbers:
result.append(number*number)
return result

@time_it
def calc_cube(numbers):
result = []
for number in numbers:
result.append(number*number*number)
return result

array = range(1,100000)
out_square = calc_square(array)
out_cube = calc_cube(array)
5 changes: 5 additions & 0 deletions Basics/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
sum: 14 | 6,8
sum: 13 | 7,6
sum: 10 | 2,8
sum: 14 | 9,5
sum: 15 | 9,6
486 changes: 486 additions & 0 deletions Basics/test.ipynb

Large diffs are not rendered by default.

11 changes: 11 additions & 0 deletions Basics/word_occurences.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
s = "I work in bloomberg founded by bloomberg work work"

tokens = s.split(" ")
d = {}
for token in tokens:
if token in d:
d[token] += 1
else:
d[token] = 1

print(d)
11 changes: 11 additions & 0 deletions Modules/pandas_tutorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import pandas as pd

stats = {
'Month': ['Jan', 'Feb', 'March', 'April'],
'Expenses': [2350, 3400, 2700, 2200],
'Income': [4000, 4000, 4000, 4000]
}

df = pd.DataFrame(stats)
# df = df.set_index('Month')
print(df.Month)
Binary file added jupyter/jupyter_architecture.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
262 changes: 262 additions & 0 deletions jupyter/jupyter_stocks.ipynb

Large diffs are not rendered by default.

491 changes: 491 additions & 0 deletions jupyter/pandas_tutorial_on_stock_price.ipynb

Large diffs are not rendered by default.

16 changes: 16 additions & 0 deletions jupyter/pandas_tutorial_on_stock_price.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Pandas Tutorial On Stock Price Analysis

# This tutorial will cover how to retrieve stock price from google finance using pandas data reader. The analysis of stock is done by plotting its high, low, close, volumne values in table and a chart. Charts are of two types,
#
# 1. Line Chart
# 2. Bar Chart
#
# If you don't know what is stock then first **watch this video to gain understanding on fundamentals of stocks and investing**,
# https://www.youtube.com/embed/XRO6lEu9-5w

import pandas.io.data as web
df = web.DataReader('AAPL', 'google', '2016/1/1', '2017/1/1')
df.head()
df.plot(y='Close', color="Green")
df.plot.bar(y='Volume')

331 changes: 331 additions & 0 deletions jupyter/python_pandas_notebook.ipynb

Large diffs are not rendered by default.

89 changes: 89 additions & 0 deletions matpltlib/plt_intro.ipynb

Large diffs are not rendered by default.

8 changes: 8 additions & 0 deletions matpltlib/plt_introduction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import matplotlib.pyplot as plt
x = [1,2,3]
y = [50,55,40]
plt.plot(x,y)
plt.xlabel('Day')
plt.ylabel('Temperature')
plt.title('Weather Chart')
plt.show()
3 changes: 3 additions & 0 deletions numpy/numpy_tutorail_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import numpy as np

a=np.array([[1,2,3],[4,5,6]])
19 changes: 19 additions & 0 deletions numpy/numpy_tutorial.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import numpy as np
import time
import sys
SIZE = 1000000
l1 = range(SIZE)
l2 = range(SIZE)
a1=np.arange(SIZE)
a2=np.arange(SIZE)

# python list
start = time.time()
result = [(x+y) for x,y in zip(l1,l2)]
print("python list took: ",(time.time()-start)*1000)
# numpy array
start= time.time()
result = a1 + a2
print("numpy took: ", (time.time()-start)*1000)


Loading

0 comments on commit 72565f9

Please sign in to comment.