Skip to content

Commit 0b62bbc

Browse files
Chris R. AlbonChris R. Albon
authored andcommitted
Initial commit
0 parents  commit 0b62bbc

File tree

5 files changed

+76
-0
lines changed

5 files changed

+76
-0
lines changed

Python3.sublime-build.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# To make Python3 work with sublimetext
2+
3+
# 1. Go to tools/build system/build new system
4+
5+
# 2. Paste in this (if you have Anaconda installed)
6+
7+
{
8+
"cmd": ["/Users/chrisralbon/anaconda/envs/python3/bin/python3", "-u", "$file"],
9+
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
10+
"selector": "source.python"
11+
}
12+

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
code_py
2+
=======
3+
4+
Some well commented code snippits in (mostly) Python 3

ipython-run-terminal.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Running iPython with Anaconda's Python 3
2+
3+
1. Open the terminal
4+
5+
2. Run:
6+
7+
export PATH=/Users/chrisralbon/anaconda/envs/py3k/bin:$PATH
8+
ipython notebook
9+
10+
# How to install a module, in this case pandas
11+
12+
export PATH=/Users/chrisralbon/anaconda/envs/py3k/bin:$PATH
13+
pip install pandas
14+
15+
# To make Python3 work with sublimetext
16+
17+
1. Go to tools/build system/build new system
18+
19+
2. Paste in this (if you have Anaconda installed)
20+
21+
{
22+
"cmd": ["/Users/chrisralbon/anaconda/envs/py3k/bin/python3", "-u", "$file"],
23+
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
24+
"selector": "source.python"
25+
}

simulated-dataframe.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Create a simple dataframe with simulated values
2+
3+
# Import pandas and numpy
4+
import pandas as pd
5+
import numpy as np
6+
7+
# Create a dataframe of 3 columns of 8 random values.
8+
# The dataframe has row index (i.e. row names) of dates and the column names A, B, and C
9+
df = pd.DataFrame(np.random.randn(100, 3), index=pd.date_range('1/1/2000', periods=100), columns=['A', 'B', 'C'])
10+
11+
# View the dataframe
12+
print(df)
13+
14+
# View the value in the 1st row and the "A" column
15+
print(df['A'][0])

test.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Test script to check the right environment is being used and one of the data science modules is installed
2+
3+
# Import sys module
4+
import sys
5+
6+
# Print the path to the Python environment
7+
print(sys.executable)
8+
9+
# Run a quick test to see if numpy module is installed
10+
import numpy as np
11+
arr = np.arange(100)
12+
print(arr)
13+
14+
# Run a quick test to see if pandas module is installed
15+
import pandas as pd
16+
df = pd.DataFrame(np.random.randn(8, 3), index=pd.date_range('1/1/2000', periods=8), columns=['A', 'B', 'C'])
17+
print(df)
18+
19+
# View the first 4 rows
20+
print(df[0:4])

0 commit comments

Comments
 (0)