<jupyter_start><jupyter_text><jupyter_code>from google.colab import files
uploaded = files.upload()
import numpy as np 
import pandas as pd
missing_values = ["n/a", "na", "--"]
df = pd.read_excel('R. Data - 1 tab.xlsx',na_values = missing_values)
any(df.isnull())
df_new = df.fillna(df.PartySize.median()) #filling null values on median in Partysize
df_new.isna().any()
df_new.drop(['StoreCode','Year','Time','TicketCode','DTS','Day','Month','Date'],axis=1,inplace=True) #dropping unnecessary columns 
import seaborn as sns
sns.countplot(x='Shift',hue='Day Type',data=df_new)
df_weekday = df_new[df_new['Day Type']=='Weekday']#seperating weekday and weekend columns from dataset 
df_weekend = df_new[df_new['Day Type']=='Weekend']
df_weekday.shape, df_weekend.shape  # we have balnaced dataset for weekday and weekend , no need to do samplling
weekday=pd.DataFrame([]) 
for i in range(129):
  weekday = weekday.append(df_weekday)
weekend=pd.DataFrame([]) 
for i in range(52):
  weekend = weekend.append(df_weekend)
weekday.shape, weekend.shape
from datetime import datetime  # date generation based on weekday and wweekend
start = datetime(2019, 1, 1)
end = datetime(2019, 6, 30)
date_sun = pd.date_range(start, end, freq='W-SUN')
date_sat = pd.date_range(start, end, freq='W-SAT')
date_weekday = pd.date_range(start,end, freq='B')
date_weekend= date_sat.union(date_sun)
d = []
for j in range(100):
  for i in range(52):
    d.append(date_weekend[i])
all_weekend_date = pd.DataFrame(d,columns=['date'])
all_weekend_date.sort_values(by='date',inplace=True, ascending=True)
e = []
for j in range(100):
  for i in range(129):
    e.append(date_weekday[i])
all_week_date = pd.DataFrame(e,columns=['date'])
all_week_date.sort_values(by='date',inplace=True, ascending=True)
x11= weekend.reset_index(drop=True)
x12=all_weekend_date.reset_index(drop=True)
x11['date']=x12
x21= weekday.reset_index(drop=True)
x22=all_week_date.reset_index(drop=True)
x21['date'] = x22
x11,x21
final = pd.concat([x11, x21], ignore_index=True)
final.to_csv('total_data.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.15414258188824662, 'fraction_numerical': 0.026493256262042388, 'mean_word_length': 7.11328125, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '617928', 'license': 'MIT', 'n_tokens_mistral': 829, 'n_tokens_neox': 787, 'n_words': 162, 'path': 'new_learning/task2_datagen.ipynb', 'repo_name': 'Uttam580/basic_ml', 'size': '2076'}