<jupyter_start><jupyter_text>01 | Data Tables & Basic Concepts of Programming - Subscribe to my [Blog ↗](https://blog.pythonassembly.com/)- Let's keep in touch on [LinkedIn ↗](www.linkedin.com/in/jsulopz) 😄  Object-Oriented Programming > Which `objects` are predefined by Python?> - numbers> - text> - set of `objects`<jupyter_code>1
jesus
jesus = 89
jesus
sum
len
'jesus'
jesus
89
type(3.43)
type([])
type({})
'.'
'jesus'
type('.')
type('jesus')
type(89)
type(34)<jupyter_output><empty_output><jupyter_text>The Registry (_aka The Environment_) > Place where Python goes to **recognise what we type**.<jupyter_code>texto = 'hola que tal'
texto.split()
type(texto.split())
lista = [3,435,46]
lista.split()
lista.insert(hola)
hola = 'juan'
lista.insert(hola)
lista
lista.insert(0, hola)
lista
lista.append('adios')
lista
lista.remove(3)
lista<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>cargar_excel()
read_excel()
import pandas
read_excel()
import seaborn
seaborn.
pandas.csv
pandas.read_csv
pandas.read_excel()
pandas.read_excel(io = internet_usage_spain.xlsx)
maria
internet_usage_spain.xlsx
'internet_usage_spain.xlsx'
pandas.read_excel(io = 'internet_usage_spain.xlsx')
pandas.read_excel(io = 'internet_usage_spain.xlsx', sheet_name = 2)
pandas.read_excel(io = 'internet_usage_spain.xlsx', sheet_name = 1)<jupyter_output><empty_output><jupyter_text>> - How Python locates the error when it doesn't find the `filename`?<jupyter_code>pandas.read_excel(io = 'internet_usage_spain', sheet_name = 1)
df = pandas.read_excel(io = 'data/internet_usage_spain.xlsx', sheet_name = 1)
df.head()<jupyter_output><empty_output><jupyter_text>Source Code Execution > - What have happened **inside the computer** execute `read_excel()`?  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? 1. `library`2. `.` **DOT NOTATION** para acceder dentro de la libreria o del objeto3. `function()`4. pasamos `objetos` a los `parametros`5. ejecutamos6. magia borras7. nos devuelve un `objeto`<jupyter_code>type('internet_usage_spain.xlsx')
type(1)
pandas.read_excel(io = 'internet_usage_spain.xlsx', sheet_name = 1)
type(pandas.read_excel(io = 'internet_usage_spain.xlsx', sheet_name = 1))
'joaidfs'
89<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>df = pandas.read_excel(io = 'data/internet_usage_spain.xlsx', sheet_name = 1)
df.head()
pandas.describe_option
df.describe()
df
df.sum()
34
35235
df
df.describe()
type(df.describe().sum())
df.describe().sum().sum()
df.describe().sum().sum().mean()
df.describe().sum().sum().describe()
res = df.describe()
res = res.sum()
res = res.sum()
res
res.describe()
type(df)
sum
len<jupyter_output><empty_output><jupyter_text>Conclusion | Types of Functions > 1. Buit-in (Predefined) Functions> 2. External Functions from Libraries> 3. Functions within Objects  Accessing `Objects` > Objects are **data structures** that store information. > Which **syntax** do we use to access the information?  Dot Notation `.`<jupyter_code>df
df
df.values
df.age
df.age.values<jupyter_output><empty_output><jupyter_text>Square Brackets `[]`<jupyter_code>df.age
df[age]
df['age']
df['age'].values
df[['age']].values
df[['age']]<jupyter_output><empty_output><jupyter_text>Filter & Masking<jupyter_code>df<jupyter_output><empty_output><jupyter_text>Filter people older than 70<jupyter_code>mask = df.age > 70
mask
df[mask]<jupyter_output><empty_output><jupyter_text>Filter people without studies<jupyter_code>mask_edu = df.education == 'No studies'
df[mask_edu]<jupyter_output><empty_output><jupyter_text>Filter people older than 70 and without studies<jupyter_code>df[mask & mask_edu]<jupyter_output><empty_output><jupyter_text>Filter people older than 70 or without studies<jupyter_code>df[mask | mask_edu]<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13748137108792846, 'fraction_numerical': 0.011363636363636364, 'mean_word_length': 5.865728900255754, 'pattern_counts': {'":': 0, '<': 53, '<?xml version=': 0, '>': 94, 'https://': 3, 'lorem ipsum': 0, 'www.': 1, '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': '13', 'dir': 'jupyter-structured-clean-dedup', 'id': '519844', 'license': 'MIT', 'n_tokens_mistral': 1993, 'n_tokens_neox': 1897, 'n_words': 509, 'path': 'I Resolving Python with Data Science/01_Data Tables & Basic Concepts of Programming/01session_data-tables.ipynb', 'repo_name': 'Blanes3/resolving-python-data-science', 'size': '5368'}