<jupyter_start><jupyter_text><jupyter_code><jupyter_output><empty_output><jupyter_text>Training and Validation<jupyter_code>import os
import pandas as pd
import numpy as np

df = pd.read_csv(
    "https://data.heatonresearch.com/data/t81-558/auto-mpg.csv",
    na_values=['NA','?'])

# Usually a good idea to shuffle
df = df.reindex(np.random.permutation(df.index)) 

mask = np.random.rand(len(df)) < 0.8
trainDF = pd.DataFrame(df[mask])
validationDF = pd.DataFrame(df[~mask])

print(f"Training DF: {len(trainDF)}")
print(f"Validation DF: {len(validationDF)}")<jupyter_output>Training DF: 305
Validation DF: 93<jupyter_text>Converting a Dataframe to a Matrix(Going to use in Keras)<jupyter_code>df.values<jupyter_output><empty_output><jupyter_text>You might wish only to convert some of the columns, to leave out the name column, use the following code.<jupyter_code>df[['mpg', 'cylinders', 'displacement', 'horsepower', 'weight',
       'acceleration', 'year', 'origin']].values<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14370664023785926, 'fraction_numerical': 0.011892963330029732, 'mean_word_length': 6.952755905511811, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 16, 'https://': 1, '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': '4', 'dir': 'jupyter-structured-clean-dedup', 'id': '140663', 'license': 'Apache-2.0', 'n_tokens_mistral': 393, 'n_tokens_neox': 364, 'n_words': 77, 'path': 'PANDAS.ipynb', 'repo_name': 'deblu-svg/Learning-DL', 'size': '1009'}