<jupyter_start><jupyter_text>MPG Cars  Introduction:The following exercise utilizes data from [UC Irvine Machine Learning Repository](https://archive.ics.uci.edu/ml/datasets/Auto+MPG) Step 1. Import the necessary libraries<jupyter_code>import pandas as pd
import numpy as np<jupyter_output><empty_output><jupyter_text>Step 2. Import the first dataset [cars1](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars1.csv) and [cars2](https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars2.csv).       Step 3. Assign each to a variable called cars1 and cars2<jupyter_code>url1 = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars1.csv'
url2 = 'https://raw.githubusercontent.com/guipsamora/pandas_exercises/master/05_Merge/Auto_MPG/cars2.csv'
df= pd.read_csv(url1, sep = ',')
df2= pd.read_csv(url2, sep = ',')
df.head(3)
df2.head(3)<jupyter_output><empty_output><jupyter_text>Step 4. Oops, it seems our first dataset has some unnamed blank columns, fix cars1<jupyter_code>df = df.iloc[:, 0:9]
df.head(3)<jupyter_output><empty_output><jupyter_text>Step 5. What is the number of observations in each dataset?<jupyter_code>df.info()
df2.info()<jupyter_output><class 'pandas.core.frame.DataFrame'>
RangeIndex: 200 entries, 0 to 199
Data columns (total 9 columns):
 #   Column        Non-Null Count  Dtype  
---  ------        --------------  -----  
 0   mpg           200 non-null    float64
 1   cylinders     200 non-null    int64  
 2   displacement  200 non-null    int64  
 3   horsepower    200 non-null    object 
 4   weight        200 non-null    int64  
 5   acceleration  200 non-null    float64
 6   model         200 non-null    int64  
 7   origin        200 non-null    int64  
 8   car           200 non-null    object 
dtypes: float64(2), int64(5), object(2)
memory usage: 14.2+ KB<jupyter_text>Step 6. Join cars1 and cars2 into a single DataFrame called cars<jupyter_code>coches = df.append(df2)
coches<jupyter_output><empty_output><jupyter_text>Step 7. Oops, there is a column missing, called owners. Create a random number Series from 15,000 to 73,000.<jupyter_code>coches['owners'] = np.random.randint(15000, 73000, coches.shape[0])
coches.head(2)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11525129982668977, 'fraction_numerical': 0.05589254766031196, 'mean_word_length': 3.9443254817987152, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 25, 'https://': 5, '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': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '494080', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 910, 'n_tokens_neox': 818, 'n_words': 188, 'path': '05_Merge/Auto_MPG/Exercises.ipynb', 'repo_name': 'iamoespana92/pandas_exercises', 'size': '2308'}