Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
758b889
Update about-me.md
anieaslan Aug 21, 2019
bfea5e1
changes
anieaslan Aug 22, 2019
5280acd
changes
anieaslan Aug 22, 2019
39b3548
changes
anieaslan Aug 22, 2019
6d8504c
updated files
anieaslan Sep 6, 2019
dd9d28c
changes
anieaslan Sep 6, 2019
d37a304
sept9
anieaslan Sep 9, 2019
88262e3
more code
anieaslan Sep 10, 2019
6f6f76f
sql
anieaslan Sep 17, 2019
3b9ab46
Update main.py
anieaslan Sep 17, 2019
b2d1584
Update main.py
anieaslan Sep 18, 2019
7aeca6f
Update main.py
anieaslan Sep 18, 2019
607523a
sept20
anieaslan Sep 20, 2019
4ae02cf
SEPT26
anieaslan Sep 26, 2019
937c970
changes
anieaslan Sep 26, 2019
be3c1f8
regex updated
anieaslan Sep 26, 2019
62e7a89
pandasproject
anieaslan Sep 28, 2019
5d1c08c
pandas
anieaslan Sep 28, 2019
f28de4d
Rename module-1/pandas-project.ipynb to module-1/pandas-project/your-…
anieaslan Sep 29, 2019
a3e1e72
SEP29
anieaslan Sep 29, 2019
54876b1
game
anieaslan Oct 2, 2019
4980c2b
project
anieaslan Oct 2, 2019
ac440cf
api's
anieaslan Oct 6, 2019
93602f8
sat12
anieaslan Oct 12, 2019
200115a
remove acreditacion
anieaslan Oct 13, 2019
b34337b
parallelization
anieaslan Oct 14, 2019
3cc8317
lab-subsetting
anieaslan Oct 16, 2019
67299fd
lab-subsetting
anieaslan Oct 16, 2019
a3c0a99
Scipy
anieaslan Oct 18, 2019
62f8318
advanced-pandas-deep-dive-df-calculation
anieaslan Oct 21, 2019
17e3b4b
labs
anieaslan Oct 22, 2019
27a679c
pivot
anieaslan Oct 24, 2019
0b003a7
pivot
anieaslan Oct 24, 2019
731ed71
feedback
anieaslan Oct 25, 2019
f1c2612
matplot
anieaslan Oct 28, 2019
2d63c81
probability
anieaslan Oct 30, 2019
d805224
discrete-prob
anieaslan Oct 30, 2019
c8ed0cb
labs-visualization
anieaslan Nov 4, 2019
5eac1c9
prob
anieaslan Nov 6, 2019
af3d3b0
project and more
anieaslan Nov 8, 2019
110ae18
update
anieaslan Nov 8, 2019
3b0d391
update
anieaslan Nov 8, 2019
eeb7a7f
updates
anieaslan Nov 9, 2019
a02dc69
labs
anieaslan Nov 22, 2019
4723284
rs lab
anieaslan Nov 25, 2019
510acc9
project
anieaslan Dec 3, 2019
5527a5a
project
anieaslan Dec 7, 2019
5c544c5
tableau
anieaslan Dec 7, 2019
2d3adb1
labs
anieaslan Jan 5, 2020
2dab30e
project
anieaslan Jan 11, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions module-1/Tuesday10.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# x = int("123")
# print(isinstance(x, int))

# x = set([1,2,2,2,3])
# print(isinstance(x, set)

#RECURSION CALLING ITSELF UNTIL IT MEET ITS INTERNAL REQUERIMENTS

# def countto10(x):
# if x < 10:
# return countto10(x +1)
# else:
# return x

# print(countto10(0))


# def inception(x):
# if len(x) < 100:
# return inception(x + "within a memory")
# else:
# return x + '.'

# print(inception("This is a memory"))


# def twodim(mat):
# count=0
# for item in mat:
# if isinstance(item,list):
# count+= twodim(item)
# return count+1

# print(twodim([[1,2], [1,2,3],[1,2,3]]))


def addM(a, b):
res = []
for i in range(len(a)):
row = []
for j in range(len(a[0])):
row.append(a[i][j]+b[i][j])
res.append(row)
return res

print(addM([[1,2],[1,2]], [[1,2],[1,2]]))

class Student:
# Initialize
def __init__(self, name, adj):
self.name = name
self.adj = adj

# All other functions are class methods
def nickname(self):
return self.adj + ' ' + self.name

annie = Student("Annie", "Amazing")
122 changes: 122 additions & 0 deletions module-1/Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# LIST COMPREHENSION\n",
"\n",
"# Reading Multiple Files\n",
"# One use case where list comprehensions come in handy is when data is split across multiple files. For example, suppose we had a data directory that contained several CSV files (among other files), each with the same information (columns) for separate groups or divisions. We could use a list comprehension with an endswith('.csv') condition in it to get a list of just the CSV files in that directory. We could use another list comprehension to have Pandas read each of those files and then the pd.concat method to combine them all into a single data set that we can analyze as follows.\n",
"\n",
"import os\n",
"import pandas as pd\n",
"\n",
"file_list = [f for f in os.listdir('./data') if f.endswith('.csv')]\n",
"data_sets = [pd.read_csv(os.path.join('./data', f)) for f in file_list]\n",
"data = pd.concat(data_sets, axis=0)\n",
"\n",
"# Selecting Data Frame Columns Based on Conditions\n",
"\n",
"data = pd.read_csv('vehicles.csv')\n",
"\n",
"selected_columns = [col for col in data._get_numeric_data() if data[col].mean() > 15]\n",
"print(selected_columns)\n",
"\n",
"['Year', 'Fuel Barrels/Year', 'City MPG', 'Highway MPG', 'Combined MPG', 'CO2 Emission Grams/Mile', 'Fuel Cost/Year']"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# TUPLES\n",
"\n",
"# Tuples are sequences just like list. However, the main difference between tuples and lists is that tuples are immutable. This means that the values inside of a tuple cannot be overwritten (or mutated) once the tuple is defined.\n",
"\n",
"# We define tuples using parentheses and specify the sequence in our tuple as follows:\n",
"\n",
"chocolates = ('dark', 'milk', 'semi sweet')"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"John\n",
"Paul\n",
"George\n",
"Ringo\n",
"312-555-1234\n",
"312-555-3123\n",
"312-555-3333\n",
"312-555-2222\n",
"John: 312-555-1234\n",
"Paul: 312-555-3123\n",
"George: 312-555-3333\n",
"Ringo: 312-555-2222\n"
]
}
],
"source": [
"# DICTS\n",
"\n",
"# Sometimes we don't just want to store data in a sequence. There are cases where we want to easily retrieve our data rather than iterate through an entire list. There are also cases where we need to label our data. For example, the phone numbers stored in our phone are labeled using the name of our contacts. In these cases, it is better to use a dict. Dicts are a sequence of key value pairs. We store the data behind the scenes in a hash map. This means that we use the key to generate a unique index (called a hash) and store the value in the location marked by that index. This makes retrieval very fast.\n",
"\n",
"# We can manually create a dict by specifying all keys and values separated by a colon within curly braces.\n",
"\n",
"contacts = {'John': '312-555-1234', 'Paul': '312-555-3123', 'George': '312-555-3333', 'Ringo': '312-555-2222'}\n",
"\n",
"# Iterating Through a Dict\n",
"\n",
"# We can use keys to iterate through the keys, values() to iterate through the values and items() to iterate through both simultaneously.\n",
"\n",
"for i in contacts.keys():\n",
" print(i)\n",
"\n",
"for i in contacts.values():\n",
" print(i)\n",
"\n",
"for k, v in contacts.items():\n",
" print(k+\": \"+v)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
110 changes: 110 additions & 0 deletions module-1/Untitled1.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"5\n",
"4\n",
"3\n",
"2\n",
"1\n",
"0\n",
"-1\n",
"-2\n",
"-3\n"
]
},
{
"ename": "KeyboardInterrupt",
"evalue": "",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyboardInterrupt\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-4-4d750a924e79>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"FINISH\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 12\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 13\u001b[0;31m \u001b[0mcountdown\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m5\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;32m<ipython-input-4-4d750a924e79>\u001b[0m in \u001b[0;36mcountdown\u001b[0;34m(x)\u001b[0m\n\u001b[1;32m 7\u001b[0m \u001b[0;32mwhile\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m<\u001b[0m \u001b[0;36m10\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 8\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mx\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 9\u001b[0;31m \u001b[0msleep\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 10\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mx\u001b[0m \u001b[0;34m-\u001b[0m \u001b[0;36m1\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 11\u001b[0m \u001b[0mprint\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m\"FINISH\"\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n",
"\u001b[0;31mKeyboardInterrupt\u001b[0m: "
]
}
],
"source": [
"# make a timer, given 10 it should print out 10 to 0 , 1 per second\n",
"\n",
"from time import sleep\n",
"\n",
"\n",
"def countdown (x):\n",
" while x < 10:\n",
" print(x)\n",
" sleep(1)\n",
" x = x - 1\n",
" print(\"FINISH\")\n",
"\n",
"countdown(5)"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"9\n",
"8\n",
"7\n",
"6\n",
"5\n",
"4\n",
"3\n",
"2\n",
"1\n",
"0\n"
]
}
],
"source": [
"import time\n",
"for i in reversed(range(0, 10)):\n",
" time.sleep(1)\n",
" print (\"%s\\r\" %i)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.3"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Loading