<jupyter_start><jupyter_text>01. Tablas, Graficas & Conceptos Basicos de Programacion     Resolver dudas → Pregunta en  Discord    Tutoriales →  YouTube    Reservar Clases → @ sotastica  Definir una variable > Asignar un `objeto` (numero, letras) a una `variable`.<jupyter_code>u = 5
u + 6 
u
u = hola
hola = 89
u = hola<jupyter_output><empty_output><jupyter_text>Donde deberia estar definido?Donde esta buscando Python por hola?- el registro  El Registro > Lugar donde Python va a buscar las palabras que escribimos.<jupyter_code>45
3.43
'a;joiwjaoj'
asdf
adios
pandas
type(45)
type(3.43)
type('a;joiwjaoj')
texto = 'hola que tal'
count(texto)
len(texto)<jupyter_output><empty_output><jupyter_text>Uso de Funciones  Funciones Predefinidas en Python (_Built-in_ Functions) > https://docs.python.org/3/library/functions.html<jupyter_code>count(texto)
len(texto)<jupyter_output><empty_output><jupyter_text>Use of Functions  Predefined Functions in Python (_Built-in_ Functions) > https://docs.python.org/3/library/functions.html  Discipline to Search Solutions in Google > Apply the following steps when **looking for solutions in Google**:>> 1. **Necesity**: How to load an Excel in Python?> 2. **Search in Google**: by keywords>   - `load excel python`>   - ~~how to load excel in python~~> 3. **Solution**: What's the `function()` that loads an Excel in Python?>   - A Function to Programming is what the Atom to Phisics.>   - Every time you want to do something in programming>   - **You will need a `function()`** to make it>   - Theferore, you must **detect parenthesis `()`**>   - Out of all the words that you see in a website>   - Because they indicate the presence of a `function()`.  External Functions > Download [this Excel](https://github.com/sotastica/data/raw/main/internet_usage_spain.xlsx).> Apply the above discipline and make it happen 🚀> I want to see the table, c'mon 👇<jupyter_code>read_excel()
import pandas
read_excel()
pandas.read_excel()
import matplotlib.pyplot as plt
plt.scatter()
plt.plot()
plt.plot([4,3,4])
pandas.read_excel(io=)
pandas.read_excel(io=internet_usage_spain)
pandas.read_excel(io='internet_usage_spain.xlsx')<jupyter_output><empty_output><jupyter_text>si no lo encuentra?- deberia estar buscando een algun sitio?- **working directory**<jupyter_code>import os
os.getcwd()
os.listdir()
os.listdir('data')
pandas.read_excel(io='data/internet_usage_spain.xlsx', sheet_name= 1)
pandas.read_excel(io='data/internet_usage_spain.xlsx', sheet_name='internet_usage')<jupyter_output><empty_output><jupyter_text>The Elements of Programming > - `Library`: where the code of functions are stored.>   - `Function`: execute several lines of code with one `word()`.>       - `Parameter`: to **configure** the function's behaviour.>           - `Object`: **data structure** to store information.  Code Syntax **What happens inside the computer when we run the code?**> In which order Python reads the line of code?> - From left to right.> - From up to down.> Which elements are being used in the previous line of code?<jupyter_code>import numpy
numpy.can_cast()
numpy.<jupyter_output><empty_output><jupyter_text>1. `library`2. `.` **DOT NOTATION** para acceder a la funcion3. `function()`4. pasamos `objetos` a los `parametros/argumentos`5. ejecutamos6. mandamos parametros al codigo fuente7. nos devuelve un `OBJETO`<jupyter_code>type(pandas.read_excel(io='data/internet_usage_spain.xlsx', sheet_name= 1))
texto
texto.split()
pepa = pandas.read_excel(io='data/internet_usage_spain.xlsx', sheet_name= 1)
pepa<jupyter_output><empty_output><jupyter_text>Functions inside Objects > - The `dog` makes `guau()`: `dog.guau()`> - The `cat` makes `miau()`: `cat.miau()`> - What could a `DataFrame` make? `object.` + `[tab key]`<jupyter_code>dog.miau()
pepa.describe()
pepanum.describe()
pepanum = pepa.to_numpy()
pepanum.d
pepa.describe().describe().mean().sum()
pepa.describe().describe().mean().sum().describe()<jupyter_output><empty_output><jupyter_text>Chaining  Accessing `Objects` > Objects are **data structures** that store information. > Which **syntax** do we use to access the information?<jupyter_code>pepa.mean()
pepa.mean('age')
pepa.mean(axis='age')<jupyter_output><empty_output><jupyter_text>Dot Notation `.`<jupyter_code>pepa.age
pepa
type(pepa.age)
pepa.age.mean()
pepa.age.sum()<jupyter_output><empty_output><jupyter_text>Square Brackets `[]`<jupyter_code>x = 'age'
pepa[x]
pepa['age'].mean()
pepa['age'].sum()<jupyter_output><empty_output><jupyter_text>`DataFrame` Manipulation > Could we solve the following questions with a `DataFrame` **object**?  How many people are in each study category?<jupyter_code>pepa.value_counts()
pepa.value_counts().plot(kind='bar')
pepa.hist()
pepa.education.value_counts()
pepa.education.value_counts().plot(kind='bar')<jupyter_output><empty_output><jupyter_text>Age average by internet usage<jupyter_code>pepa.groupby(by='internet_usage')
pepa.groupby(by='internet_usage').mean()
pepa.groupby(by='internet_usage')['age'].mean()<jupyter_output><empty_output><jupyter_text>Age average by internet usage and gender<jupyter_code>pepa.groupby(by='internet_usage', axis='gender')
pepa.groupby(by=['internet_usage', 'sex']).age.mean()
pepa.groupby(by=['internet_usage', 'sex']).age.mean().plot(kind='bar')
pepa.groupby(by=['internet_usage', 'sex']).age.mean().to_frame()
pepa.groupby(by=['internet_usage', 'sex']).age.mean().to_frame().plot(kind='bar')<jupyter_output><empty_output><jupyter_text>Data Visualization with Python  Load Another Dataset > We load this [csv file](https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv).> ¿What does it mean `csv`?> ¿Why don't we use an `Excel` to better see the data?<jupyter_code>import pandas as pd
a = pd.read_html('https://en.wikipedia.org/wiki/List_of_countries_and_dependencies_by_population')
len(a)
a[0]
a[1]
df = pd.read_csv(filepath_or_buffer='https://raw.githubusercontent.com/mwaskom/seaborn-data/master/tips.csv')
df.head()<jupyter_output><empty_output><jupyter_text>Scatterplot  With `Matplotlib` library > Scatterplot<jupyter_code>import matplotlib.pyplot as plt
import matplotlib
matplotlib.scatter()
import matplotlib.pyplot
df.head()
%matplotlib inline
matplotlib.pyplot.scatter(x='total_bill', y='tip')
df.head()
matplotlib.pyplot.scatter(x='total_bill', y='tip', data=df)<jupyter_output><empty_output><jupyter_text>With `Seaborn` library > Scatterplot<jupyter_code>import seaborn
seaborn.scatter(x='total_bill', y='tip', data=df)
plt.scatter(x='total_bill', y='tip', data=df,color='red')
red = 'green'
plt.scatter(x='total_bill', y='tip', data=df,color=red)
seaborn.scatterplot(x='total_bill', y='tip', data=df, hue='sex')<jupyter_output><empty_output><jupyter_text>With `Plotly` library > Scatterplot<jupyter_code>import plotly.express as px
px.scatter(x='total_bill', y='tip', data_frame=df, color='sex')
px.scatter(x='total_bill', y='tip', data=df, hue='sex')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14726224783861672, 'fraction_numerical': 0.005187319884726225, 'mean_word_length': 6.969001148105626, 'pattern_counts': {'":': 0, '<': 73, '<?xml version=': 0, '>': 113, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '18', 'dir': 'jupyter-structured-clean-dedup', 'id': '458952', 'license': 'MIT', 'n_tokens_mistral': 2624, 'n_tokens_neox': 2532, 'n_words': 557, 'path': '#01. Tablas, Graficas & Conceptos Basicos de Programacion/sesion.ipynb', 'repo_name': 'jaimee8/machine-learning-program', 'size': '6940'}