<jupyter_start><jupyter_text>Analysis Report III  Residential Real Estate  In the previous file (3_Types_of_real_estate) an analysis was made of what were the types of properties contained in the database. Here, an analysis was made to filter only residential properties from the database, removing other types of properties that we were not interested in, such as Industrial, Commercial Complex, Standard Land, etc ... After filtering only the types of properties that we are interested in for analysis, a new file was created in csv format using the to_csv function, this file contains a database with the residential properties that interest us.<jupyter_code>import pandas as pd
dados = pd.read_csv('dados/aluguel.csv', sep = ';')
dados.head(10)
# list with the types of residence contained in the Type column
list(dados['Tipo'].drop_duplicates())
# I just need the types of residential properties
# that's why I created the 'residential' variable, which stores residential properties
residencial = [ 'Quitinete',
                'Casa',
                'Apartamento',
                'Casa de Condomínio',
                'Casa de Vila']
residencial
dados.head(10)
# Isin checks if the values are contained in the Series and returns Boolean values
# returns True on the lines where the properties selected as residential are
# returns False on the lines where non-residential properties are contained
selecao = dados['Tipo'].isin(residencial)
selecao
# creating a new variable that stores the selection data, we now have only residential properties
# there are 22,580 residential properties out of 32,960 types of properties in total
dados_residencial = dados[selecao]
dados_residencial
# here are the objects on the list, containing only the types of properties we want
list(dados_residencial['Tipo'].drop_duplicates())
dados_residencial.shape[0]
# the index function displays the first 10 items and the last 10 items in a list
# we can sort with the range function
dados_residencial.index
# sorting with the range function
dados_residencial.index = range(dados_residencial.shape[0])
dados_residencial<jupyter_output><empty_output><jupyter_text>Exporting the Database<jupyter_code># exporting the file with the to_csv function with the separator (';')
# we now have a document in csv format in our database
dados_residencial.to_csv('dados/aluguel_residencial.csv', sep = ';')
# reading the created file - residential rent, which contains the data with the types of residential properties
# the dados_residencial_2 variable receives these values
dados_residencial_2 = pd.read_csv('dados/aluguel_residencial.csv', sep = ';')
dados_residencial_2.head(10)
# creating the file 'dados_residencial.csv' passing the index = False
dados_residencial.to_csv('dados/aluguel_residencial.csv', sep = ';', index = False)
dados_residencial_2 = pd.read_csv('dados/aluguel_residencial.csv', sep = ';')
dados_residencial_2<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06841388699795779, 'fraction_numerical': 0.009530292716133424, 'mean_word_length': 5.253191489361702, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '643046', 'license': 'MIT', 'n_tokens_mistral': 856, 'n_tokens_neox': 804, 'n_words': 332, 'path': '4_Residential_real_estate.ipynb', 'repo_name': 'bsmiranda/Data_science', 'size': '2938'}