<jupyter_start><jupyter_text>Housing Market  Introduction:This time we will create our own dataset with fictional numbers to describe a house market. As we are going to create random data don't try to reason of the numbers. Step 1. Import the necessary libraries<jupyter_code>import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>Step 2. Create 3 differents Series, each of length 100, as follows: 1. The first a random number from 1 to 4 2. The second a random number from 1 to 33. The third a random number from 10,000 to 30,000<jupyter_code>s1 = pd.Series(np.random.randint(1, high = 5, size = 100, dtype = 'l'))
s2 = pd.Series(np.random.randint(1, high = 4, size = 100, dtype = 'l'))
s3 = pd.Series(np.random.randint(10000, high = 30001, size = 100, dtype = 'l'))
print(s1.head(5), '\n')
print(s2.head(5), '\n')
print(s3.head(5), '\n')<jupyter_output>0    1
1    2
2    3
3    2
4    3
dtype: int64 

0    3
1    2
2    1
3    2
4    2
dtype: int64 

0    22127
1    11676
2    27760
3    28917
4    24750
dtype: int64<jupyter_text>Step 3. Let's create a DataFrame by joinning the Series by column<jupyter_code>housemkt = pd.concat([s1, s2, s3], axis = 1)
housemkt.head(10)<jupyter_output><empty_output><jupyter_text>Step 4. Change the name of the columns to bedrs, bathrs, price_sqr_meter<jupyter_code>housemkt.rename(columns = {0 : 'bedrs', 1 : 'bathrs', 2 : 'price_sq_meter'}, inplace = True)
housemkt.head()<jupyter_output><empty_output><jupyter_text>Step 5. Create a one column DataFrame with the values of the 3 Series and assign it to 'bigcolumn'<jupyter_code># join concat the values
bigcolumn = pd.concat([s1, s2, s3], axis = 0)
bigcolumn.head()

# it is still a Series, so we need to transform it to a DataFrame
bigcolumn = bigcolumn.to_frame()
print(type(bigcolumn))
bigcolumn.head()<jupyter_output><class 'pandas.core.frame.DataFrame'><jupyter_text>Step 6. Oops, it seems it is going only until index 99. Is it true?<jupyter_code># no the index are kept but the length of the DataFrame is 300
len(bigcolumn)<jupyter_output><empty_output><jupyter_text>Step 7. Reindex the DataFrame so it goes from 0 to 299<jupyter_code>bigcolumn.reset_index(drop = True, inplace = True)
bigcolumn<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1051930758988016, 'fraction_numerical': 0.06169551708832668, 'mean_word_length': 4.720812182741117, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 28, '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': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '600363', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 897, 'n_tokens_neox': 812, 'n_words': 278, 'path': '05_Merge/Housing Market/Exercises.ipynb', 'repo_name': 'samirlenka/pandas_exercises', 'size': '2253'}