<jupyter_start><jupyter_text>Project: Statistics information about customer reservations  Table of ContentsIntroductionData WranglingExploratory Data AnalysisConclusions  IntroductionThe work contains several stages that the data goes through to facilitate dealing with it and benefit from it in solving problems and answering the most important questions. In this work, data about Hotel booking were used in the first stage.The data was read from a CSV file that contains 10000 rows and 30 columns.In the second stage, some columns that contained a large lack of information were deleted and were not helpful in the solution. In the third stage, the data was used after processing to answer three main questions and represent them graphically in order to facilitate understanding of the results.  Throughout this work, we are tring to answer this question by exploring the data set and also the connections among variables: and we will answer: 1- What type of customer is the most? Is it Transient or Contract or ...?2- How many reservations are from USA?3- What year has the most reservations?  Importing the libraries<jupyter_code>import numpy as np
import pandas as pd
from sklearn.preprocessing import OneHotEncoder
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Data Wrangling General Properties : Read dataset from CSV file<jupyter_code>dataset = pd.read_csv('hotel_bookings.csv')
dataset.head()
## we want to know the count of columns and index
dataset.shape
## we want to check if we have a null values or not
pd.isna(dataset).sum()
## we want to check if the datatypes is well?
## and check if there any mistakes in the names of columns
dataset.info()
## from the min of 'Age' = -1, We can notice that there is an error, and it will be fixed in the next steps
dataset.describe()<jupyter_output><empty_output><jupyter_text>Data Cleaning (Here we will fix the mistakes we saw it from pervious steps)  Drop some not necessary columns and filling NaN values with most frequent values<jupyter_code>dataset=dataset.drop('is_canceled', axis='columns')
dataset=dataset.drop('lead_time', axis='columns')
dataset=dataset.drop('stays_in_weekend_nights', axis='columns')
dataset=dataset.drop('stays_in_week_nights', axis='columns')
dataset=dataset.drop('adults', axis='columns')
dataset=dataset.drop('children', axis='columns')
dataset=dataset.drop('company', axis='columns')
dataset=dataset.drop('is_repeated_guest', axis='columns')
dataset=dataset.drop('previous_cancellations', axis='columns')
dataset = dataset.apply(lambda x: x.fillna(x.value_counts().index[0]))
dataset2 = dataset<jupyter_output><empty_output><jupyter_text>Convert column values to numbers instead of categories to facilitate data handling<jupyter_code>dataset['arrival_date_month'] = dataset['arrival_date_month'].replace({
    'January':1,
    'February':2,
    'March':3,
    'April':4,
    'May':5,
    'June':6,
    'July':7,
    'August':8,
    'September':9,
    'October':10,
    'November':11,
    'December':12
})
dataset.head(1000)<jupyter_output><empty_output><jupyter_text>Exploratory Data Analysis  Questions : Research Q. 1) What type of customer is the most? ( Here will we see ype of customer, Transient or Contract or Transient-Party or Group )  Here we will create two data set, one for Transient, and one for Contract:<jupyter_code>Transient = dataset2.query('customer_type  == "Transient"')
Contract = dataset2.query('customer_type  == "Contract"')
Transient_Party = dataset2.query('customer_type  == "Transient-Party"')
Group = dataset2.query('customer_type  == "Group"')<jupyter_output><empty_output><jupyter_text>Here we will see the number of Transient and Contract and Transient-Party and Group:<jupyter_code>len(Transient)
len(Contract)
len(Transient_Party)
len(Group)<jupyter_output><empty_output><jupyter_text>Now we will use pie chart to see each type of customer :<jupyter_code>pie = pd.DataFrame({'mass': [len(Transient),  len(Contract), len(Transient_Party), len(Group)],
                   'radius': [len(Transient),  len(Contract), len(Transient_Party), len(Group)]},
                  index=['Transient', 'Contract', 'Transient_Party', 'Group'])
plot = pie.plot.pie(y='mass', figsize=(5, 5))<jupyter_output><empty_output><jupyter_text>The answer:<jupyter_code>x = dataset2['customer_type'].value_counts().idxmax()
print("Customer Type:",x)<jupyter_output>Customer Type: Transient<jupyter_text>2) How many reservations are from USA? ( Here will we see the number of USA reservations )  Now we will use bar chart to see many reservations are from USA:<jupyter_code>USA = dataset2.query('country  == "USA"')
plt.bar("USA", len(USA))
plt.title('How many reservations are from USA?')
plt.ylabel('reservations from USA')
plt.show()<jupyter_output><empty_output><jupyter_text>We can see that the number of USA reservations is : 58  The answer:<jupyter_code>print("Number of USA reservations:",len(USA))<jupyter_output>Number of USA reservations: 58<jupyter_text>Research Q. 3) What year has the most reservations? ( Here will we see the year that has the most reservations )  Now we will use pie chart to see the percentage of  each year:<jupyter_code>dataset2['arrival_date_year'].value_counts().plot.pie(figsize=(7,7), autopct='%1.1f%%', fontsize = 12)
plt.show()<jupyter_output><empty_output><jupyter_text>So, we can notice the percentage of 2016 is more than any year  The answer:<jupyter_code>x = dataset2['arrival_date_year'].value_counts().idxmax()
print("The year has the most reservations:",x)<jupyter_output>The year has the most reservations: 2016
{'fraction_non_alphanumeric': 0.10365198711063373, 'fraction_numerical': 0.011278195488721804, 'mean_word_length': 6.274739583333333, 'pattern_counts': {'":': 0, '<': 46, '<?xml version=': 0, '>': 46, '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': '12', 'dir': 'jupyter-structured-clean-dedup', 'id': '629981', 'license': 'CNRI-Python', 'n_tokens_mistral': 1726, 'n_tokens_neox': 1633, 'n_words': 566, 'path': 'Data Science.ipynb', 'repo_name': 'trok4774/P1', 'size': '5586'}