-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2277631
commit 5e22902
Showing
5,316 changed files
with
10,771,414 additions
and
1 deletion.
The diff you're trying to view is too large. We only load the first 3000 changed files.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
4,788 changes: 4,788 additions & 0 deletions
4,788
Dataset modeling for financial time series data.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
175 changes: 175 additions & 0 deletions
175
Plotting the historical data on USD BRL on matplotlib.ipynb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,175 @@ | ||
{ | ||
"cells": [ | ||
{ | ||
"cell_type": "code", | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"outputs": [ | ||
{ | ||
"name": "stdout", | ||
"output_type": "stream", | ||
"text": [ | ||
"72.87\n", | ||
"9147.87991648\n" | ||
] | ||
}, | ||
{ | ||
"data": { | ||
"text/plain": [ | ||
"(0, 0)" | ||
] | ||
}, | ||
"execution_count": 10, | ||
"metadata": {}, | ||
"output_type": "execute_result" | ||
} | ||
], | ||
"source": [ | ||
"\n", | ||
"\n", | ||
"#show(p)\n", | ||
"import pandas as pd\n", | ||
"\n", | ||
"countries = ['Albania', 'Algeria', 'Andorra', 'Angola', 'Antigua and Barbuda',\n", | ||
" 'Argentina', 'Armenia', 'Australia', 'Austria', 'Azerbaijan',\n", | ||
" 'Bahamas', 'Bahrain', 'Bangladesh', 'Barbados', 'Belarus',\n", | ||
" 'Belgium', 'Belize', 'Benin', 'Bhutan', 'Bolivia']\n", | ||
"\n", | ||
"life_expectancy_values = pd.Series([74.7, 75. , 83.4, 57.6, 74.6, 75.4, 72.3, 81.5, 80.2,\n", | ||
" 70.3, 72.1, 76.4, 68.1, 75.2, 69.8, 79.4, 70.8, 62.7,\n", | ||
" 67.3, 70.6])\n", | ||
"\n", | ||
"gdp_values = pd.Series([ 1681.61390973, 2155.48523109, 21495.80508273, 562.98768478,\n", | ||
" 13495.1274663 , 9388.68852258, 1424.19056199, 24765.54890176,\n", | ||
" 27036.48733192, 1945.63754911, 21721.61840978, 13373.21993972,\n", | ||
" 483.97086804, 9783.98417323, 2253.46411147, 25034.66692293,\n", | ||
" 3680.91642923, 366.04496652, 1175.92638695, 1132.21387981])\n", | ||
"\n", | ||
"\n", | ||
"# Life expectancy and gdp data in 2007 for 20 countries\n", | ||
"life_expectancy = pd.Series(life_expectancy_values)\n", | ||
"gdp = pd.Series(gdp_values)\n", | ||
"\n", | ||
"# Change False to True for each block of code to see what it does\n", | ||
"\n", | ||
"# Accessing elements and slicing\n", | ||
"if False:\n", | ||
" print life_expectancy[0]\n", | ||
" print gdp[3:6]\n", | ||
" \n", | ||
"# Looping\n", | ||
"if False:\n", | ||
" for country_life_expectancy in life_expectancy:\n", | ||
" print 'Examining life expectancy {}'.format(country_life_expectancy)\n", | ||
" \n", | ||
"# Pandas functions\n", | ||
"if False:\n", | ||
" print life_expectancy.mean()\n", | ||
" print life_expectancy.std()\n", | ||
" print gdp.max()\n", | ||
" print gdp.sum()\n", | ||
"\n", | ||
"# Vectorized operations and index arrays\n", | ||
"if False:\n", | ||
" a = pd.Series([1, 2, 3, 4])\n", | ||
" b = pd.Series([1, 2, 1, 2])\n", | ||
" \n", | ||
" print a + b\n", | ||
" print a * 2\n", | ||
" print a >= 3\n", | ||
" print a[a >= 3]\n", | ||
" \n", | ||
"\n", | ||
"\n", | ||
"def variable_correlation(variable1, variable2):\n", | ||
" '''\n", | ||
" Fill in this function to calculate the number of data points for which\n", | ||
" the directions of variable1 and variable2 relative to the mean are the\n", | ||
" same, and the number of data points for which they are different.\n", | ||
" Direction here means whether each value is above or below its mean.\n", | ||
" \n", | ||
" You can classify cases where the value is equal to the mean for one or\n", | ||
" both variables however you like.\n", | ||
" \n", | ||
" Each argument will be a Pandas series.\n", | ||
" \n", | ||
" For example, if the inputs were pd.Series([1, 2, 3, 4]) and\n", | ||
" pd.Series([4, 5, 6, 7]), then the output would be (4, 0).\n", | ||
" This is because 1 and 4 are both below their means, 2 and 5 are both\n", | ||
" below, 3 and 6 are both above, and 4 and 7 are both above.\n", | ||
" \n", | ||
" On the other hand, if the inputs were pd.Series([1, 2, 3, 4]) and\n", | ||
" pd.Series([7, 6, 5, 4]), then the output would be (0, 4).\n", | ||
" This is because 1 is below its mean but 7 is above its mean, and\n", | ||
" so on.\n", | ||
" '''\n", | ||
" mean1 = variable1.mean()\n", | ||
" mean2 = variable2.mean()\n", | ||
" print mean1\n", | ||
" print mean2\n", | ||
" \n", | ||
" #variable1 = variable1[variable1 > mean1]\n", | ||
" #variable2 = variable2[variable2 > mean2]\n", | ||
"\n", | ||
" \n", | ||
" num_same_direction = 0 # Replace this with your code\n", | ||
" num_different_direction = 0 # Replace this with your code\n", | ||
" \n", | ||
" #for index, value in variable1.iteritems():\n", | ||
" # if value > mean1:\n", | ||
" # if variable2[index] > mean2:\n", | ||
" # num_same_direction = num_same_direction + 1\n", | ||
" #elif value < mean1:\n", | ||
" # if variable2[index] < mean2:\n", | ||
" # num_same_direction = num_same_direction + 1\n", | ||
" #elif value > mean1:\n", | ||
" # if variable2[index] < mean2:\n", | ||
" # num_different_direction = num_different_direction + 1\n", | ||
" #elif value < mean1:\n", | ||
" # if variable2[index] > mean2:\n", | ||
" # num_different_direction = num_different_direction + 1\n", | ||
" \n", | ||
"\n", | ||
" \n", | ||
" \n", | ||
" \n", | ||
" \n", | ||
" \n", | ||
"\n", | ||
" \n", | ||
" return (num_same_direction, num_different_direction)\n", | ||
"\n", | ||
"\n", | ||
"variable_correlation(life_expectancy_values, gdp_values)\n" | ||
] | ||
}, | ||
{ | ||
"cell_type": "code", | ||
"execution_count": null, | ||
"metadata": {}, | ||
"outputs": [], | ||
"source": [] | ||
} | ||
], | ||
"metadata": { | ||
"kernelspec": { | ||
"display_name": "Python 2", | ||
"language": "python", | ||
"name": "python2" | ||
}, | ||
"language_info": { | ||
"codemirror_mode": { | ||
"name": "ipython", | ||
"version": 2 | ||
}, | ||
"file_extension": ".py", | ||
"mimetype": "text/x-python", | ||
"name": "python", | ||
"nbconvert_exporter": "python", | ||
"pygments_lexer": "ipython2", | ||
"version": "2.7.12" | ||
} | ||
}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# Kamaji | ||
#### Documentation provided in IPython Notebook - Algar Kamaji Documentation |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"cells": [], | ||
"metadata": {}, | ||
"nbformat": 4, | ||
"nbformat_minor": 2 | ||
} |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.