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
rowid | species | island | bill_length_mm | bill_depth_mm | flipper_length_mm | body_mass_g | sex | year | |
---|---|---|---|---|---|---|---|---|---|
1 | Adelie | Torgersen | 39.1 | 18.7 | 181 | 3750 | male | 2007 | |
2 | Adelie | Torgersen | 39.5 | 17.4 | 186 | 3800 | female | 2007 | |
3 | Adelie | Torgersen | 40.3 | 18 | 195 | 3250 | female | 2007 | |
4 | Adelie | Torgersen | NA | NA | NA | NA | NA | 2007 | |
5 | Adelie | Torgersen | 36.7 | 19.3 | 193 | 3450 | female | 2007 | |
6 | Adelie | Torgersen | 39.3 | 20.6 | 190 | 3650 | male | 2007 | |
7 | Adelie | Torgersen | 38.9 | 17.8 | 181 | 3625 | female | 2007 | |
8 | Adelie | Torgersen | 39.2 | 19.6 | 195 | 4675 | male | 2007 | |
9 | Adelie | Torgersen | 34.1 | 18.1 | 193 | 3475 | NA | 2007 |
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
with open('texto.txt', encoding='utf8') as file: | |
text = file.read() | |
cleaned_words = text.replace('.', ' ').replace('\n', ' ').replace('?', '').replace('(', '').replace(')', '').replace(',', ' ').split(' ') | |
dedup_words = list(set(cleaned_words)) | |
sorted_words = sorted(dedup_words, key=len, reverse=True) | |
first_ten_words = sorted_words[:10] | |
print('Ten longest words in file:', first_ten_words) |
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
import re | |
senhas = """ | |
12345678 | |
J3sus0 | |
#Te5t300 | |
J*90j12374 | |
Michheeul | |
Monk3y6 | |
MARC3L0& |
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
"The Ministry of Truth, which concerned itself with news, entertainment, education and the fine arts. The Ministry of Peace, which concerned itself with war. The Ministry of Love, which maintained law and order. And the Ministry of Plenty, which was responsible for economic affairs. Their names, in Newspeak: Minitrue, Minipax, Miniluv and Miniplenty." |
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
"Assim, na América, quando o sol se põe, eu me sento no velho e arruinado cais do rio olhando os longos, longos céus acima de Nova Jersey, e consigo sentir toda aquela terra crua e rude se derramando numa única, inacreditável e elevada vastidão, até a costa oeste, e a estrada seguindo em frente, todas as pessoas sonhando naquela imensidão, e em Iowa eu sei que agora as crianças devem estar chorando na terra onde deixam as crianças chorar, e você não sabe que Deus é a Ursa Maior? A estrela do entardecer deve estar morrendo e irradiando sua pálida cintilância sobre a pradaria, reluzindo pela última vez antes da chegada da noite completa, que abençoa a terra, escurece todos os rios, recobre os picos e oculta a última praia, e ninguém, ninguém sabe o que vai acontecer a qualquer pessoa, além dos desamparados andrajos da velhice." |
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
O array que vamos usar tem as primeira 5 letras do alfabeto: | |
array = ['a', 'b', 'c', 'd', 'e'] | |
Se quisermos nos referir a elas, precisamos saber quais so as posições que elas ocupam no array. | |
Então, ao referenciarmos o array: | |
array = ['a', 'b', 'c', 'd', 'e'] | |
Seria o mesmo que "usar" o array como referência, pois as posições das letras começam a contar do 0: | |
array = [0, 1, 2, 3, 4] |
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
# -*- coding: utf-8 -*- | |
# adicionei a linha de itf-8 porque o terminal pediu, mas você pode desconsiderá-la | |
import pandas as pd | |
from collections import Counter | |
df = pd.read_csv('busca.csv') | |
X_df = df[['home', 'busca', 'logado']] | |
Y_df = df['comprou'] | |
Xdummies_df = pd.get_dummies(X_df).astype(int) |