Difference between revisions of "Python for Data Science"
Adelo Vieira (talk | contribs) (→Most popular Python Data Science Libraries) |
Adelo Vieira (talk | contribs) (→NumPy) |
||
Line 81: | Line 81: | ||
<br /> | <br /> | ||
===NumPy=== | ===NumPy=== | ||
+ | * NumPy is a Linear Algebra Library for Python, the reason it is so important for Data Science with Python is that almost all of the libraries in the PyData Ecosystem rely on NumPy as one of their main building blocks. | ||
+ | |||
+ | * NumPy is also incredibly fast, as it has bindings to C libraries. | ||
+ | |||
+ | * It is highly recommended you install Python using the Anaconda distribution to make sure all anderlying dependencies (such as Linear Algebra libraries) all sync up with the use of a conda install. | ||
+ | |||
+ | |||
+ | <br /> | ||
+ | ====Installation==== | ||
+ | * If you have Anaconda, install NumPy by: | ||
+ | conda install numpy | ||
+ | |||
+ | * If you are not using Anaconda distribution: | ||
+ | pip install numpy | ||
+ | |||
+ | |||
+ | <br /> | ||
+ | ====NumPy Arrays==== | ||
+ | * NumPy arrays are the main way we will use NumPy throughout the course. | ||
+ | |||
+ | * NumPy arrays essentially come in two flavors: vectors and matrices. | ||
+ | |||
+ | * Vectors are strictly 1-d arrays and matrices are 2-d (but you should note a matrix can still have only one row or one column). | ||
+ | |||
+ | |||
+ | Let's create a List. Then, using numpy we can cast this List into an Array. In this case, a 1-d Array (Vector) | ||
+ | <syntaxhighlight lang="python"> | ||
+ | my_list = [1,2,3] | ||
+ | |||
+ | import numpy as np | ||
+ | |||
+ | vector = np.array(my_list) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | If we want a 2-d Array, we can first create a List of List and then we can cast it into a 2-d Matrix: | ||
+ | <syntaxhighlight lang="python"> | ||
+ | list_of_lists = [[1,2,3],[4,5,6],[7,8,9]] | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | Creating an Array using NumPy built-in generation methods: | ||
+ | <syntaxhighlight lang="python"> | ||
+ | np.arange(0,10) | ||
+ | |||
+ | np.zeros(10) | ||
+ | np.zeros((2,3)) # In this example: N. of rows: 2 ; N. of columns: 3 | ||
+ | |||
+ | np.ones((3,4)) | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | |||
+ | Lucture 18, min 4:20 | ||
+ | <br /> |
Revision as of 22:50, 10 October 2019
Contents
Anaconda
Anaconda is a free and open source distribution of the Python and R programming languages for data science and machine learning related applications (large-scale data processing, predictive analytics, scientific computing), that aims to simplify package management and deployment. Package versions are managed by the package management system conda. https://en.wikipedia.org/wiki/Anaconda_(Python_distribution)
En otras palabras, Anaconda puede ser visto como un paquete (a distribution) que incluye no solo Python (or R) but many libraries that are used in Data Science, as well as its own virtual environment system. It's an "all-in-one" install that is extremely popular in data science and Machine Learning.
Installation
https://linuxize.com/post/how-to-install-anaconda-on-ubuntu-18-04/
Anaconda comes with a few IDE
- Jupyter Lab
- Jupyter Notebook
- Spyder
- Qtconsole
- and others
Anaconda Navigator is a GUI that helps you to easily start important applications and manage the packages in your local Anaconda installation
You can open the Anaconda Navigator from the Terminal:
anaconda-navigator
Jupyter
Jupyter comes with Anaconda.
- It is a development environment (IDE) where we can write codes; but it also allows us to display images, and write down markdown notes.
- It is the most popular IDE in data science for exploring and analyzing data.
- Other famoues IDE for Python are Sublime Text and PyCharm.
- There is Jupyter Lab and Jupyter Notebook
Online Jupyter
There are many sites that provides solutions to run your Jupyter Notebook in the cloud: https://www.dataschool.io/cloud-services-for-jupyter-notebook/
I have tried:
- https://cocalc.com/projects/595bf475-61a7-47fa-af69-ba804c3f23f9/files/?session=default
- Parece bueno, pero tiene opciones que no son gratis
- https://www.kaggle.com/adeloaleman/kernel1917a91630/edit
- Parece bueno pero no encontré la forma adicionar una TOC
-
- Es el que estoy utilizando ahora
Udemy - Python for Data Science and Machine Learning Bootcamp
https://www.udemy.com/course/python-for-data-science-and-machine-learning-bootcamp/
Most popular Python Data Science Libraries
- NumPy
- SciPy
- Pandas
- Seaborn
- SciKit'Learn
- MatplotLib
- Plotly
- PySpartk
NumPy
- NumPy is a Linear Algebra Library for Python, the reason it is so important for Data Science with Python is that almost all of the libraries in the PyData Ecosystem rely on NumPy as one of their main building blocks.
- NumPy is also incredibly fast, as it has bindings to C libraries.
- It is highly recommended you install Python using the Anaconda distribution to make sure all anderlying dependencies (such as Linear Algebra libraries) all sync up with the use of a conda install.
Installation
- If you have Anaconda, install NumPy by:
conda install numpy
- If you are not using Anaconda distribution:
pip install numpy
NumPy Arrays
- NumPy arrays are the main way we will use NumPy throughout the course.
- NumPy arrays essentially come in two flavors: vectors and matrices.
- Vectors are strictly 1-d arrays and matrices are 2-d (but you should note a matrix can still have only one row or one column).
Let's create a List. Then, using numpy we can cast this List into an Array. In this case, a 1-d Array (Vector)
my_list = [1,2,3]
import numpy as np
vector = np.array(my_list)
If we want a 2-d Array, we can first create a List of List and then we can cast it into a 2-d Matrix:
list_of_lists = [[1,2,3],[4,5,6],[7,8,9]]
Creating an Array using NumPy built-in generation methods:
np.arange(0,10)
np.zeros(10)
np.zeros((2,3)) # In this example: N. of rows: 2 ; N. of columns: 3
np.ones((3,4))
Lucture 18, min 4:20