#!/usr/bin/env python
# coding: utf-8

# In[2]:


import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns


# In[5]:


Applications_df = pd.read_csv("C:\\Users\\Asrar Khan\\Desktop\\Jupyter\\Applications_Sample.csv")
Job_posts_df = pd.read_csv("C:\\Users\\Asrar Khan\\Desktop\\Jupyter\\Job_Posts_Sample.csv")


# In[7]:


# make a copy of our data
applcs_df = Applications_df
# The posts data
job_posts_df = Job_posts_df


# In[9]:


applcs_df.head()


# In[10]:


job_posts_df.head()


# In[11]:


# fix the application date
applcs_df.app_date = pd.to_datetime(applcs_df.app_date)


# In[13]:


applcs_df.head()


# In[14]:


# test
applcs_df.dtypes


# In[15]:


# set the index for app_date
applcs_df.index = applcs_df['app_date']


# In[16]:


applcs_df.head()


# In[17]:


# remove the app_date column
applcs_df.drop(columns='app_date',axis= 1,inplace=True)
applcs_df["count"] = 1


# In[18]:


applcs_df.head()


# In[19]:


# explore more info about the job-posts data
job_posts_df.info()


# In[20]:


# drop the unneeded columns 
columns_drop = ['job_category2','job_category3','job_industry2','job_industry3']
job_posts_df.drop(columns=columns_drop, axis=1, inplace=True)


# In[21]:


# rename the columns
job_posts_df.rename(columns={'job_category1': 'job_category', 'job_industry1': 'job_industry'}, inplace=True)


# In[22]:


job_posts_df.head()


# In[23]:


# convert post_date to datetime 
job_posts_df.post_date = pd.to_datetime(job_posts_df['post_date'])


# In[29]:


# extract month name
job_posts_df['month'] = job_posts_df.post_date.apply(lambda x: x.month_name())


# In[30]:


# extract  name of the day
job_posts_df['day'] = job_posts_df.post_date.apply(lambda x: x.day_name())


# In[31]:


job_posts_df.head()


# In[33]:


# Missing values and duplicates:

# check for null values
job_posts_df.isnull().sum()


# In[34]:


# check for the null values in currency column
job_posts_df.loc[job_posts_df.currency.isnull()]


# In[36]:


# fix the null values and converts it to Egyptian pound
l = job_posts_df.loc[job_posts_df.currency.isnull()].index
for i in l:
    job_posts_df.loc[i,'currency'] ='Egyptian Pound'


# In[37]:


job_posts_df.head()


# In[38]:


# check
job_posts_df.currency.isnull().sum()


# In[39]:


# check for duplicates values
job_posts_df.duplicated().sum()


# In[40]:


# get sample
job_posts_df.sample()


# In[ ]:




