<jupyter_start><jupyter_text>This notebook is used to process the raw googleplaystore dataset to obtain a dataset in line with HackerRank's train and test datasets used for the Data Scientist Assessment.<jupyter_code>import pandas as pd
import numpy as np

df = pd.read_csv("../data/input/raw/googleplaystore.csv")
df.head(5)
# Create 'app_id' column
df['app_id'] = df.groupby(['App']).ngroup()
df.head(5)
# Drop rows where 'Rating' is not given
df = df[df['Rating'].notna()]

# Convert 'Rating' column to a class
df['popularity'] = np.where(df['Rating'] >= 4, 'High', 'Low')
# Drop not necessary column
df.drop(columns=['App', 'Rating', 'Type', 'Genres', 'Android Ver'], inplace=True)

df.head(5)
df.rename(columns={"Content Rating": "suitable_for", "Last Updated": "last_update", "Current Ver": "latest_ver"}, inplace=True)
df.columns = [x.lower() for x in df.columns]
df.head(5)
from sklearn.model_selection import train_test_split

train, test = train_test_split(df, test_size=0.33, random_state=42)

train.to_csv('../data/input/processed/train.csv', index=False)
test.to_csv('../data/input/processed/test.csv', index=False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15975820379965458, 'fraction_numerical': 0.008635578583765112, 'mean_word_length': 6.154320987654321, 'pattern_counts': {'":': 3, '<': 5, '<?xml version=': 0, '>': 6, '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': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '348169', 'license': 'MIT', 'n_tokens_mistral': 410, 'n_tokens_neox': 396, 'n_words': 106, 'path': 'notebook/dataset_wrangling.ipynb', 'repo_name': 'jovi-s/app-popularity', 'size': '1158'}