<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Okwuazu Ifeakachukwu on Medium]]></title>
        <description><![CDATA[Stories by Okwuazu Ifeakachukwu on Medium]]></description>
        <link>https://medium.com/@ifeanyiokwuazu?source=rss-784c4bff8457------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*ilI4zMeiNaOS3EYaXgUY0w@2x.jpeg</url>
            <title>Stories by Okwuazu Ifeakachukwu on Medium</title>
            <link>https://medium.com/@ifeanyiokwuazu?source=rss-784c4bff8457------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 01:23:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ifeanyiokwuazu/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Tips for Tableau tooltip]]></title>
            <link>https://medium.com/@ifeanyiokwuazu/tips-for-tableau-tooltip-58e270924134?source=rss-784c4bff8457------2</link>
            <guid isPermaLink="false">https://medium.com/p/58e270924134</guid>
            <category><![CDATA[tableau]]></category>
            <dc:creator><![CDATA[Okwuazu Ifeakachukwu]]></dc:creator>
            <pubDate>Thu, 06 Oct 2022 22:53:19 GMT</pubDate>
            <atom:updated>2022-10-07T22:17:02.239Z</atom:updated>
            <content:encoded><![CDATA[<p>Sitting at my desk in the office today, beaming with pride at the beautiful Tableau dashboard (by my standards 😁) I made, a thought came to my mind- what if I could make it even more engaging? how do I make this piece of analytical artistry even better?</p><p>I would confess I haven’t always been quite the strategist, my friends Ronald and Jon excel in this regard comparatively. I believe in results, I would rather have a terrible first draft in two days than spend a week pondering the best strategy before starting out, while that gives me a head start, it often results in the barest minimum!</p><p>So today I decided to be Jon and Ronald, I put myself in their big, brainy, shrewd shoes and dared to go the extra mile. I was going to make my dashboards more powerful.</p><p>Bar charts are perhaps the most colloquial visualisation, a go-to for all and sundry. The measurement of a quantity across categories is a very common thing in data analytics, and yes I had lots of bar charts on my dashboard, how could I not? but today, I was going to spice up my bar charts using the tooltip tile.</p><p>I had a simple bar chart (1 categorical variable vs discrete variable) and a stacked bar chart (2 categorical variables against 1 discrete variable). The plan was to display customised text on the tooltip when you hover over each bar in the case of the simple bar chart and for each segment in the stacked bar chart. I straightway searched on google and Youtube to see if I could leverage the geniuses of my fellow data professionals. To my surprise, the materials I found were for the most part unrelated to my specific predicament, how hard can it be to find materials for such a mundane task? surely someone had walked the very grounds I was standing on in the past. After a rigorous search, I gave up! I was still determined to solve this conundrum, so I went back to the big ol’ trial and error method.</p><p><strong><em>Caveat: The charts used in this article are for demonstration purposes only, the data from which they are made are publicly available at : </em></strong><a href="https://www.kaggle.com/datasets/vivek468/superstore-dataset-final?resource=download">https://www.kaggle.com/datasets/vivek468/superstore-dataset-final?resource=download</a></p><p><strong>Scenario 1: Simple bar chart (one categorical vs one discrete variable)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E2vhLT7vzMFAaLgzHotJJQ.png" /><figcaption>Sneak peek of the dataset</figcaption></figure><p>Step 1</p><p>Skipping all preliminary steps such as downloading, saving and uploading the data to Tableau.</p><ol><li>Drag any categorical variable(e.g Category) to rows and a discrete variable (e.g Profit) to columns to automatically create a bar chart in tableau. Also, drag profit to text to add the sum of profit to the end of each bar. I have removed all gridlines and axes for simplicity.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bZngB_tKaRMNMCjVEPuu1Q.png" /><figcaption>Boring ol’ bar chart of the sum of profit per category</figcaption></figure><p>2. Let&#39;s get spicy!</p><p>I want to input customised text for each bar, such that it displays as the user hovers over the chart.</p><p>Create the following simple text for the following bars</p><ul><li>For total profit in the Technology category, we will display the message <em>“ </em><strong><em>Technological items yielded the highest profit among all the categories</em></strong><em>”</em></li><li>For the second bar i.e Office Supplies, we want it to read “<strong><em>Office Supplies yielded more profit than furniture, but less than Technological items</em></strong>”</li><li>For the last bar which is Furniture, we would display the following text “<strong><em>Furniture yielded the least profit of all the categories</em></strong>”</li></ul><p>we would use a combination of LOD expressions and the custom text in a calculated field. Click the dropdown on the search pane and select create a calculated field, this opens a new window, where we would write the code below</p><p>If [Category]==’Technology’ THEN ‘Technological items yielded the highest profit among all the categories’<br>ELSEIF [Category]==’ Office Supplies’ THEN ‘Office Supplies yielded more profit than furniture, but less Technological items’<br>ELSEIF [Category]==’ Furniture’ THEN ‘Furniture yielded the least profit of all the categories’<br>END</p><p>See the images below for reference.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XgqX5jUxgWewCIVnSkxH2g.png" /><figcaption>Navigation for creating the calculated field.</figcaption></figure><p>Click Ok to create our calculated field named <strong><em>Customised text.</em></strong></p><p>3. Step it up a notch!</p><p>Create a new sheet, drag the calculated field( Customised text) to text, change view to Entire view, then rename the sheet appropriately e.g <strong>hover text </strong>as seen in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3-cN88gcTdF02hnHVnRR5w.png" /><figcaption>The sheet containing hover text.</figcaption></figure><p>4. Finally!</p><p>Go back to the bar chart in step 1, click on the tooltip tile, and clear the content if there is any. Select insert, sheet and attach the hover text sheet. Click ok as illustrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PinHvIrL7vYvxFqshA3ZKA.png" /><figcaption>Attaching the hover text sheet to tooltip</figcaption></figure><p>The final display is presented in the images below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bWXfyB-QOHeU6e_-zLWcpQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*co5TW0jDw7DWOYgMJisHjQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*98FIffdJakfzGlt3mjx1AQ.png" /><figcaption>Final view of customised text per bar</figcaption></figure><p>I have made this very methodical and stepwise for Tableau newbies like myself, and if you are wondering what exclamation I let out when i saw the final result? It was Eureka, Eureka !</p><p>We are only limited by our mindset, it is true what they say “impossibility is nothing”</p><p><strong>In my next story, I will extend the methodology for a stacked bar chart use case</strong></p><p>Thanks for reading.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=58e270924134" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airbnb data analysis part 3/3]]></title>
            <link>https://medium.com/@ifeanyiokwuazu/airbnb-data-analysis-part-3-3-ae7d1c159d64?source=rss-784c4bff8457------2</link>
            <guid isPermaLink="false">https://medium.com/p/ae7d1c159d64</guid>
            <dc:creator><![CDATA[Okwuazu Ifeakachukwu]]></dc:creator>
            <pubDate>Sun, 15 May 2022 16:42:42 GMT</pubDate>
            <atom:updated>2022-05-15T17:00:08.600Z</atom:updated>
            <content:encoded><![CDATA[<p>Text analytics of Airbnb reviews data</p><p>In this final article of my Airbnb data analysis series, we would explore the use of text analytics to implement the pointwise mutual information (PMI) metric, a word association metric introduced in 1992, to the Airbnb reviews. The purpose of PMI is to extract, from free text, pairs of words than tend to co-occur together more often than expected by chance. For example, PMI(‘new’, ‘york’) would give a higher score than PMI(‘new’, ‘car’) because the chance of finding ‘new’ and ‘york’ together in the text is higher than ‘new’ and ‘car’, despite ‘new’ being a more frequent word than ‘york’. By extracting word pairs with high PMI scores in our reviews, we will be able to understand better how people feel and talk about specific items of interest (e.g., ‘windows’ or ‘location’).</p><p>The formula for PMI (where a and b are two words) is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/702/1*Tm5SGAXIy53q_UPq_aYQkQ.png" /><figcaption>Pointwise mutual information formula</figcaption></figure><p><strong>The data</strong></p><p>The dataset for this analysis is the Airbnb reviews data titled ‘reviews.csv’ which contains relevant information from Airbnb users on the quality of service and overall level of satisfaction based on their experience. Our focus is mainly on the <strong>comments</strong> section. The dimension of the dataset is (452143, 6).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xo4D9o3lUmbx2Hd2ZuBZkw.png" /><figcaption>Sneak peek of the dataset</figcaption></figure><h3><strong>Step 1</strong></h3><p>The preliminary step is to perform some pre-processing of the comment column to make it fit-for-purpose. We do this in three major steps;</p><p>i. Tokenization: This is a fundamental process in Natural Language processing where large chunks of texts are broken down into words or sentences called tokens which makes it easier to understand context and for creating models. Tokens can be words or sentences, here we tokenized the text using word_tokenize from the nltk library.</p><p>ii. Part-of-speech (PoS) tagging: to be able to differentiate nouns from adjectives or verbs, we do this using nltk’s pos_tag method.</p><p>iii. Lower case: to reduce the size of the vocabulary</p><p>These three steps are implemented in a function and the results are displayed in the image below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PKZr6tWmXqO67AKz2J5QPA.png" /><figcaption>function to implement tokenization, pos_tagging and lower tagging of words.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6gtiXs0xsYqiMUUVCY811w.png" /><figcaption>The output of the function above.</figcaption></figure><h3>Step 2</h3><p>In this step, we create a vocabulary of ‘center’ (the a in the PMI equation) and ‘context’ (the b in the PMI equation) words. Our vocabulary of center words will be the 1,000 most frequent NOUNS (words with a PoS tag starting with ‘N’), and the context words will be the 1,000 most frequent words tagged as either VERB or ADJECTIVE (words with any PoS tag starting with either ‘J’ or ‘V’). To do this, we implement a function get_vocab(df) which takes as input the DataFrame generated in step 1 and returns two lists, one for the 1,000 most frequent center words (nouns) and one for the 1,000 most frequent context words (either verbs or adjectives).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlYGNblulwy2FrzX_xeThw.png" /><figcaption>Function which returns lists of Nouns and Adjectives</figcaption></figure><h3>Step 3</h3><p>With the two 1,000-word vocabularies created above, we create a co-occurrence matrix in this step where for each center word, you keep track of how many of the context words co-occur with it. Consider this short review with only one sentence as an example, where we want to get co-occurrences for verbs and adjectives for the center word restaurant:</p><p>a. ‘A <em>big</em> <strong>restaurant</strong> <em>served</em> <em>delicious</em> food in <em>big</em> dishes’</p><p>matrix — {‘restaurant’: {‘big’: 2, ‘served’:1, ‘delicious’:1}}</p><p>We implement a function get_coocs(df, center_vocab, context_vocab) which takes as input the DataFrame generated in step 1, and the lists generated in step 2 and returns a dictionary of dictionaries, of the form in the example above.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/896/1*g2PHLdx8KbSTF06Y-8De3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/919/1*DXwsja6wraGv7KZjhILyBg.png" /><figcaption>Function to create co-occurrence matrix</figcaption></figure><h3>Step 4</h3><p>Here we convert the co-occurrence dictionary as a pandas DataFrame with 1,000 rows and 1,000 columns. To do this we implement a function called cooc_dict2df(cooc_dict), which takes as input the dictionary of dictionaries generated in step 3 and returns a DataFrame where each row corresponds to one center word, and each column corresponds to one context word, and cells are their corresponding co-occurrence value. Some (a,b) pairs will never co-occur, hence the value 0 returned for those cases. The output is shown below;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AArGhsCqdggWEejVvDM06Q.png" /><figcaption>Dataframe of the co-occurrence matrix</figcaption></figure><h3>Step 5</h3><p>Next, we convert the co-occurrence values to PMI scores using a function cooc2pmi(df) that takes as input the DataFrame generated in step 4, and returns a new DataFrame with the same rows and columns, but with PMI scores instead of raw co-occurrence counts as illustrated below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*H69nwpNpocATuJz4AaOHFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M9fRXjTXvfBshc1EmdHstQ.png" /><figcaption>Algorithm(L) and output(R) which generate the PMI score for the co-occurrence matrix.</figcaption></figure><h3>Step 6</h3><p>Finally, we implement a method to retrieve context words with the highest PMI score for a given centre word. To do this, we implement a function topk(df, center_word, N=10) that takes as input: (1) the DataFrame generated in step 5, (2) a center word (a string like ‘towels’), and (3) an optional named argument called N with default value of 10; and returns a list of N strings, in descending order of their PMI score with the center_word. See images below ;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*4Z9PXdX3M9XfttsJ7PLqfA.png" /><figcaption>Function which returns the top 10 context words for each given center word.</figcaption></figure><p>From the result of step 6 above, we can see a clear connection between the center word ‘coffee’ and the output/context words. PMI scores help us to understand semantics and is used in various disciplines e.g. in information theory, linguistics or chemistry (in profiling and analysis of chemical compounds) and can be really useful in understanding human behavior especially how people talk and what their interests may be.</p><p>Link to notebook:<a href="https://github.com/Ifexy/Data-science-portfolio/blob/main/Airbnb%20review%20analysis.ipynb">https://github.com/Ifexy/Data-science-portfolio/blob/main/Airbnb%20review%20analysis.ipynb</a></p><p>If you have enjoyed this article, please clap and share. To connect with me please click the links to my social media handles.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/okwuazu/">https://www.linkedin.com/in/okwuazu/</a></p><p>Twitter : <a href="https://twitter.com/JOkwuazu">https://twitter.com/JOkwuazu</a></p><p>Instagram: <a href="https://www.instagram.com/jefferson_okwuazu/">https://www.instagram.com/jefferson_okwuazu/</a></p><p>Thanks for reading !!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ae7d1c159d64" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airbnb data analysis part 2/3]]></title>
            <link>https://medium.com/@ifeanyiokwuazu/airbnb-data-analysis-part-2-3-c01a86de9302?source=rss-784c4bff8457------2</link>
            <guid isPermaLink="false">https://medium.com/p/c01a86de9302</guid>
            <dc:creator><![CDATA[Okwuazu Ifeakachukwu]]></dc:creator>
            <pubDate>Sat, 12 Mar 2022 16:05:01 GMT</pubDate>
            <atom:updated>2022-03-12T20:57:37.225Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Statistical analysis of Airbnb listings data</strong></p><p>Welcome to the second section of our analysis of Airbnb listings data. In this part, we perform a statistical analysis(hypothesis testing) of the dataset and build a machine-learning algorithm to predict the price of listings based on historical data.</p><p>Statistics and machine learning are very important concepts in data science, the application of probability theory, hypothesis testing and predictive modelling can help the data professional create real value which can inform stakeholder decision making.</p><p>First of all, we observe in the data that we have an overall <em>review_scores_rating</em> column and related sub-items with scores relating to <em>accuracy, cleanliness, check-in, communication, location, value. </em>We want to investigate if the overall rating can be predicted from the scores on the subitems? To investigate this, perform a linear regression on rating using statsmodels. Before the actual linear regression, we rename the columns as shown in the code snippet below to improve the readability of the regression summary.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1017/1*LZxxA8Q_5ZvSjvIqdSQOgw.png" /><figcaption><strong>Summary of linear regression</strong></figcaption></figure><p>From the summary of the multiple linear regression test, the R-squared is probably the most important statistic along with the Adjusted R-squared. R-squared accounts for the degree to which the independent variables(sub-Items) explain the variability in the dependent (review_scores_rating) variable. The sub-items explain 72.6% of the variability in our dependent variable(price). It is well known that the value of R-squared increases with the number of variables, therefore the Adjusted R-squared which penalises this phenomenon is a more reliable statistic in multiple linear regression. A lower Adjusted R-squared than R-squared is indicative of certain redundant variables contributing no variability to the model. Here our Adjusted R-squared is the same as our R-squared and the <em>pvalues</em> of our variables are all less than the generally accepted threshold (0.05) meaning they are all significant and our model is statistically reliable and the overall rating can be predicted from the subitems.</p><p>Secondly, we would like to investigate whether the difference in prices for different room types is significant. To investigate this, perform independent samples t-tests for the prices of each combination of room types using alpha = 0.01. The result of the analysis is shown below</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1004/1*MZLfDdfO_y8POrtlGww25Q.png" /></figure><p>From the result of the t-tests above, we observe that the price for the following pairs of room types <strong><em>Private room vs Entire home/apt</em></strong><em>,</em><strong><em> Private room vs Hotel room</em></strong><em>,</em><strong><em> Entire home/apt vs Hotel room </em></strong><em>&amp; </em><strong><em>Entire home/apt vs Shared room </em></strong>is significant. Prior to the actual t-testing, we assume that there is no significant difference in the prices of the various room types which defines a null hypothesis, the <em>pvalues</em> of the aforementioned pairs of room types is less than 0.05, so we can reject the null hypotheses for those instances. when performing t-tests for multiple instances, there is always the chance of a type I error-<em>the probability of rejecting the null hypothesis given that it is true.</em></p><p>The Bonferroni correction helps us lower this risk when making multiple statistical t-tests, we adjust the alpha level(0.01)by dividing by the number of tests(6) and then obtain a new alpha level and re-do the tests to see if there is a difference in observation. After this correction, we observe that only <strong><em>Private room vs Entire home/apt p-value, Private room vs Hotel room p-value </em></strong>remain significant. For more on Bonferroni correction see: <a href="https://en.wikipedia.org/wiki/Bonferroni_correction">https://en.wikipedia.org/wiki/Bonferroni_correction</a>.</p><p>In summary, we create a data frame matrix to hold the pairwise combination of <em>pvalues</em> between the room types.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*8QhlNCVuCNUaPNXCCm3THQ.png" /><figcaption>pairwise combination of <em>pvalues</em> between the room types.</figcaption></figure><h3>Machine Learning Model to predict price</h3><p>In this section of the article, we build a random forest regressor to predict the price of listings based on certain variables.</p><p>Random forest is a state-of-the-art supervised machine learning algorithm, it produces accurate results and is great for our dataset, where the independent variables are not linearly related to our target variable as seen in the pair plot between the variable. (See link to notebook below for better understanding).</p><p>First, we select the variables with the strongest correlation with the target(price) as shown below, this is after pre-processing the data and deleting duplicates, replacing null values, encoding categorical variables e.t.c. The selected variables are shown below,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*gemhbBw1bI3ByTxtIjdiDA.png" /><figcaption>Variable Selection for Modelling.</figcaption></figure><p>We train the model on 80% of the data and retain 20% for testing. The code for the modelling phase is shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/806/1*xu-TDqM5jZ9qzPggMT93aQ.png" /><figcaption>Random Forest Model for predicting price.</figcaption></figure><p>We then perform prediction on the test data (20% of overall data) and evaluate our model performance.</p><p>One extra advantage of using an ensemble learning (e.g Random forest) model is the inbuilt <em>feature_importances_ </em>which tells us the most important predictors of price, this can serve as a means of model selection, as the top-performing predictors alone can be used to fit the data to obtain a similar result in less computation time. The image below tells us the top 10 predictors of price based on our Random forest model.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/884/1*HKJkhS2xAaFFaQmMAPTHhA.png" /><figcaption>feature importance for random forest model</figcaption></figure><p>We can see that feature_importances_ bears some similarity to the results of the correlation used earlier for selecting the features as five of the variables in the feature_importances_ are found in the first 10 variables which are strongly correlated with price.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/999/1*I24IVzFltpnXIlLp6B7Muw.png" /><figcaption>Model prediction and evaluation</figcaption></figure><p>The Mean absolute error(MAE), Mean Squared Error(MSE) and Root mean squared error (RMSE) of our model are 0.38,0.54,0.74 respectively. To get a better idea of the performance of our model during prediction, we can plot the distribution of residuals, which is the difference between the predicted and actual values for price as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/547/1*5qLk0s458mdRAawzd4x16A.png" /><figcaption>Distribution of residuals</figcaption></figure><p>From the plot above, we can see that our residuals are normally distributed around the zero mark which corroborates the near-zero error metrics observed earlier. This means we can make valid inferences about the results of our model.</p><p><strong>Conclusion</strong></p><p>We have looked at the application of statistical analysis (hypothesis testing) and predictive analytics to further derive value from the listings data. From the result of our analysis, we now understand that there is a significant relationship between the overall review and related sub-items, we also identified the significance between the prices of certain room type pairs. Lastly, we built a predictive model which can be used to predict price for new listings based on the most important predictors of price.</p><p>Link to notebook:<a href="https://github.com/Ifexy/Personal-development-/blob/209f87d9b70aa2595246549fc331374f47f2e066/Airbnb_Medium/Airbnb%20Listings%20Analysis.ipynb">https://github.com/Ifexy/Personal-development-/blob/209f87d9b70aa2595246549fc331374f47f2e066/Airbnb_Medium/Airbnb%20Listings%20Analysis.ipynb</a></p><p>If you have enjoyed this article, please clap and share. To connect with me please click the links to my social media handles.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/okwuazu/">https://www.linkedin.com/in/okwuazu/</a></p><p>Twitter : <a href="https://twitter.com/JOkwuazu">https://twitter.com/JOkwuazu</a></p><p>Instagram: <a href="https://www.instagram.com/jefferson_okwuazu/">https://www.instagram.com/jefferson_okwuazu/</a></p><p>Thanks for reading !!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c01a86de9302" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Airbnb data analysis part 1/3]]></title>
            <link>https://medium.com/@ifeanyiokwuazu/airbnb-data-analysis-part-1-3-3394d319eb9a?source=rss-784c4bff8457------2</link>
            <guid isPermaLink="false">https://medium.com/p/3394d319eb9a</guid>
            <dc:creator><![CDATA[Okwuazu Ifeakachukwu]]></dc:creator>
            <pubDate>Wed, 26 Jan 2022 12:08:59 GMT</pubDate>
            <atom:updated>2022-08-19T11:35:58.041Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LOSebiT4KrHpirPfpOQ6Jg.jpeg" /><figcaption>Image credit: <a href="https://www.reuters.com/business/airbnb-prices-shares-above-target-2020s-biggest-us-ipo-source-2020-12-11/">https://www.reuters.com/business/airbnb-prices-shares-above-target-2020s-biggest-us-ipo-source-2020-12-11/</a></figcaption></figure><p>Airbnb is a global community that connects people who want to rent their homes with people seeking accommodation in various locations around the world. It was founded in the year 2007 and has now become a renowned brand in the hospitality industry.</p><p>This is the first part of a series of three articles. The range of topics covered are ; preprocessing, exploration in part 1, statistical analysis and recommender system in the second article while the third paper explores the use of text analysis and Natural language processing(NLP) on unstructured reviews data.</p><p>In this article- Part 1, we slip into the role of a Data Scientist responsible for the Amsterdam branch of Airbnb operations. The plan is to clean the dirt from the data and provide interesting insights using exploratory analysis. The dataset for this project is publicly available at <a href="http://About - Inside Airbnb. Adding data to the debate.">About — Inside Airbnb. Adding data to the debate.</a></p><p>The code for this project can be viewed on my GitHub account: <a href="https://github.com/Ifexy/Data-science-portfolio/blob/main/Airbnb%20listings%20data%20analysis.ipynb">https://github.com/Ifexy/Data-science-portfolio/blob/main/Airbnb%20listings%20data%20analysis.ipynb</a></p><h3><strong>Data Preprocessing</strong></h3><p>Python programming language and jupyter notebook have been used throughout this analysis. The data frame contains a lot of textual data which will not be relevant for the numerical analyses in Part 1 and Part 2. Therefore, we implement two functions drop_cols and drop_cols_na which remove irrelevant columns and variables containing more than 50% null values respectively as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I4Wj2MgBVjZwEDlwAY8M1w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_31H5qLdca23HTQ0uuqCUw.png" /></figure><p><strong>Recoding and adding columns</strong></p><p>In continuation of preprocessing, we implement three functions <strong><em>binary_encoding(df): </em></strong>Converts all binary variables encoded as strings ‘t’ (for True) and ‘f’ (for False) as integer numbers 0 and 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*0KvOaZwGMtNt8OSxi3M61g.png" /></figure><p><strong><em>add_host_days(df): </em></strong>This creates a new column called ‘host_days’ that represents the number of days (with respect to the current date) that the host has been registered</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3_8ynX9Yc1FGzd4Yf0LVPg.png" /></figure><p><strong><em>convert_price(df): </em></strong>the ‘price’ column represents the nightly price in USD. However, the prices are encoded as strings. This function converts the prices into floating-point numbers. For instance, the string ‘$40’ would be converted to the floating-point number 40.0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sJrQxImOolWZ3AIN0ewCvw.png" /></figure><p><strong>Querying the dataset</strong></p><p>In this section, we run basic queries to gain useful information from the dataset e.g</p><ul><li>How many hosts offer two or more properties for rent?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/974/1*ZXMV4rabgaUXWQ0vrrtNeg.png" /></figure><p><strong><em>The variable</em></strong> <strong><em>host_listings_count, tells us how many listings the host has in total. using the combination of the greater than or equal to(&gt; =) operator on the host_listings_count column and counting the result, we observe that 2077 hosts have offered two or more properties for rent.</em></strong></p><ul><li>What is the highest price for a listing?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/871/1*ZIscJ5pwSFSAFtY3WxIMYw.png" /></figure><p><strong><em>The price column contains the price for each listing, therefore calling the df. max() function returns 8000.0 as the price for the most expensive listing.</em></strong></p><ul><li>What is the ID of the listing that has the largest number of bedrooms?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/969/1*UEjg8x3LpchPgU3agIIjeQ.png" /></figure><p><strong><em>The variable ‘bedrooms’ contains the number of bedrooms in each listing, using the df.iloc[] &amp; .idmax()functions as well as positional indexing, we extract the ID corresponding to the listing with the largest number of bedrooms which is </em></strong>46015289.</p><ul><li>What is the ID of the listing with the largest advertised price?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/752/1*-1PV2ZpWBVleN_wLT6B_-w.png" /></figure><p><strong><em>This is similar to the previous question, so we can use the same syntax as above, only replacing the variable ‘bedrooms’ with ‘price’.The code returns the value(ID) </em></strong>258273.</p><ul><li>There are different room types. How many listings are there for the most common room type?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/691/1*U0Et0zIkhfMKcQIwcQwHAQ.png" /></figure><p><strong><em>To answer this question, we call the .value_counts() function on the room_type variable, we get a series with the unique room types and their counts. We can then apply the .idxmax() function to extract the most common room type. Filtering the dataset by the result of the above processes, and counting the number of rows we get </em></strong>14433.</p><ul><li>How many hosts are there that have been registered for more than 300 days?</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*KDqds05dscmpMbJe4raSUA.png" /></figure><p><strong><em>Using the host_days column we created earlier, we can simply filter the data frame using the logical operator (&gt;), to return instances in the dataset, where the host_days is greater than 3000. The number of rows 2803 in this dataset corresponds to the number of hosts that have registered for more than 3000days.</em></strong></p><h3><strong>Exploratory analyses</strong></h3><p>To further explore the data, in this section we produce three basic plots using seaborn and matplotlib. The plots are as follows;</p><ol><li>A barplot with horizontal bars representing average nightly prices. Produce a bar for each neighbourhood (use the neighborhood_cleansed column).</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IQqVHuJ3smcN0oPWItEQFw.png" /></figure><p>From the above chart, we can clearly see that the Centrum-Oost neighbourhood has the highest average nightly prices, while Bijlmer-Centrum has the lowest average nightly prices.</p><p>2. Correlation matrix that depicts all pair-wise Pearson correlations between all sub-items in the review-ratings column. The review ratings have 5 additional subitems: cleanliness, checkin, communication, location, and value. These variables indicate the quality of the cleanliness of the property, the ease during check-in, communication with the host during stay, quality of the location , and their value for money. It could be interesting to understand the correlations between these subitems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1019/1*dF6baosb6g_DTvgGC5Nx6g.png" /></figure><p>from the correlation matrix above, we can clearly see a strong positive relationship between the review scores for communication and check-in. The correlation of 0.65 indicates that when the host provided effective communication for their guests, they had an easier check-in process. The cleanliness of the property, as well as communication, are strong indicators of a good value for money on the part of the guests.</p><p>3. Scatterplot of the geographical distribution of nightly prices for the more expensive listings.</p><p>Here we want to know the neighbourhoods where the most expensive nightly prices. The prices have been encoded both by the colour and size of the circles. Note: we have only included listings with a price larger than $150.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cS9a8MdkTy1w42UwgWh5zQ.png" /></figure><p>From the above chart, we can pinpoint locations where the listings are expensive.</p><h3><strong>Conclusion</strong></h3><p>In this part of the series- Airbnb data analysis, we have covered core fundamentals such as data preprocessing and exploratory data analysis. These are very important processes in the life cycle of a data science/analytics project. In the remaining parts 2 &amp; 3, we would dig deeper into statistical analysis and finally some text data analytics and Natural language processing(NLP).</p><p>If you have enjoyed this article, please clap and share. To connect with me please click the links to my social media handles.</p><p>LinkedIn: <a href="https://www.linkedin.com/in/okwuazu/">https://www.linkedin.com/in/okwuazu/</a></p><p>Twitter: <a href="https://twitter.com/JOkwuazu">https://twitter.com/JOkwuazu</a></p><p>Instagram: <a href="https://www.instagram.com/jefferson_okwuazu/">https://www.instagram.com/jefferson_okwuazu/</a></p><p>Thanks for reading !!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3394d319eb9a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>