<?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 Adeboladesoyin on Medium]]></title>
        <description><![CDATA[Stories by Adeboladesoyin on Medium]]></description>
        <link>https://medium.com/@adeboladesoyin?source=rss-925986e9fe77------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*jPVFEFjRRxSNRu6p</url>
            <title>Stories by Adeboladesoyin on Medium</title>
            <link>https://medium.com/@adeboladesoyin?source=rss-925986e9fe77------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 07:43:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@adeboladesoyin/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[Birthday mail Automation using Power Automate]]></title>
            <link>https://medium.com/@adeboladesoyin/birthday-mail-automation-using-power-automate-45543ef3be41?source=rss-925986e9fe77------2</link>
            <guid isPermaLink="false">https://medium.com/p/45543ef3be41</guid>
            <dc:creator><![CDATA[Adeboladesoyin]]></dc:creator>
            <pubDate>Mon, 15 Dec 2025 15:08:08 GMT</pubDate>
            <atom:updated>2025-12-15T15:13:09.515Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*p0lSNN8ZSxQr7Tz5" /><figcaption>birthday flyer</figcaption></figure><h3>Stop the Manual Grind: Automate Birthday Mails with Power Automate</h3><p><em>Are you tired of the manual effort of tracking long customer birthday lists and sending individual celebration emails? Is the annual subscription cost of external email tools sucking company resources?</em></p><p>Look no further! This article will walk you through step-by-step automation that eliminates this pain point, allowing you to:</p><ul><li>Improve efficiency immediately.</li><li>Demonstrate excellent customer experience by prioritizing your customers.</li><li>Cut costs associated with expensive mailing tools.</li></ul><p>I will guide you through building this solution using Microsoft Power Automate.</p><h3>What You’ll Need (Resources)</h3><ul><li>Microsoft Power Automate: The automation engine (<a href="https://learn.microsoft.com/en-us/power-automate/flow-types">learn more here</a>).</li><li>Birthday Image Flyer: The celebratory visual you want to send designed by your comms department.</li><li>Azure Storage Blob: Used to host your image flyer efficiently.</li></ul><h3>⚙️ Step-by-Step Guidelines</h3><h3>1. Define the Trigger (When to Run the Flow)</h3><p>For every automation in Power Automate, there is an essential starting point called the <strong>Trigger</strong>. This component determines when your flow should begin execution. Power Automate supports various trigger types, including:</p><ul><li><strong>Automatic</strong>: Responds to specific events (e.g., a file is added).</li><li><strong>Instant</strong>: Activated by user actions (e.g., clicking a button).</li><li><strong>Scheduled</strong>: Runs at predefined times.</li></ul><p>For our birthday automation, we will use a <strong>Recurrence trigger</strong>, scheduled to run <strong>daily </strong>at a specific time (e.g., 7:00 AM) to check for today’s birthdays.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/0*Jpjs0liYKYay91eG" /><figcaption>Schedule trigger flow</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/0*t6w7exUvYSa6Cgp5" /><figcaption>birthday list sample</figcaption></figure><h3>2. Connect to Your Data Source (Database or Excel)</h3><p>If your customer birthday data resides in a professional database (such as PostgreSQL, SQL Server, Snowflake, or MySQL), your next step is to connect to that database using your credentials.</p><p><strong>If you are using SQL Server</strong>, your flow steps at this stage will include using the “Execute a sql query” action or a similar connector to fetch the relevant data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/451/0*6sb3yw-wgmzntE-Y" /><figcaption>database step</figcaption></figure><blockquote><strong><em>Note on Data Source:</em></strong><em> For the purpose of this exercise, we will use a simple </em><strong><em>Excel sheet</em></strong><em> stored on OneDrive for ease of demonstration. However, in a </em><strong><em>production environment</em></strong><em>, you should always use a robust database for superior performance and reliability.</em></blockquote><p><em>When working with date fields from Excel using the “List rows present in a table” action, you must ensure the dates are correctly formatted for Power Automate to process them. In the </em><strong><em>“List rows present in a table”</em></strong><em> action properties, make sure you select the </em><strong><em>“ISO 8601”</em></strong><em> datetime format.</em></p><p><em>Selecting ISO 8601 is critical as it forces Excel dates into a standard format (</em>YYYY-MM-DDTHH:MM:SSZ<em>) that Power Automate can reliably interpret, preventing errors when we perform the date comparison and filtering in the next step.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/620/0*5Htt2IEgYGP46cYw" /><figcaption>data extraction from data source</figcaption></figure><h3>3. Filter for Today’s Birthdays (The Logic Gate)</h3><p>After connecting to your data source, the next crucial step is to isolate the customers celebrating their birthday today. We achieve this using the <strong>“Filter array” action</strong> to process the data retrieved from the previous step.</p><p>This action will compare the month and day of birth from your customer data against the current month and day.</p><p>The core logic uses Power Automate’s expression functions to ensure a perfect match, regardless of the year:</p><pre>@equals(formatDateTime(item()?[&#39;DOB&#39;], &#39;dd-MMM&#39;), formatDateTime(utcNow(), &#39;dd-MMM&#39;))</pre><p>This expression checks if the customer’s birth day and month (item()?[‘DOB’]) matches the current day and month (utcNow()), effectively selecting only today’s birthday customers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/0*G7vd7D3oM-gWSkie" /><figcaption>filter array</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/618/0*YhUH_V1PsB5yD6zE" /><figcaption>sample of run flow which return only today’s celebrant</figcaption></figure><h3>4. Send the Birthday Email (Iterating Through Celebrants)</h3><p>With our list of today’s celebrants successfully filtered, the next step is to send out the emails.</p><h3>4a. Initialize the Email Action</h3><p>When you use the “<strong>Send an email (V2)</strong>” action and enter the recipient’s email address by typing `items(‘Apply_to_each’)?[‘EMAIL’]` in the expression content of your filtered list, Power Automate will automatically wrap this action inside an <strong>“Apply to each”</strong> loop.</p><blockquote><em>Why “Apply to each”? In a production environment with potentially hundreds of celebrants daily, the “Apply to each” loop is essential. It ensures that the email is processed and sent individually and correctly for every customer in the filtered array.</em></blockquote><ul><li>Enter the recipient’s <strong>Email </strong>from the expression content.</li><li>Craft a compelling <strong>Subject </strong>line.</li><li><strong>Pro-Tip:</strong> You can optionally configure your flow to include the customer’s dedicated <strong>Relationship Manager</strong> in the CC field, depending on your organization’s configuration.</li></ul><h3>4b. Configure the Email Body and Image</h3><p>The key to displaying your beautiful birthday flyer is embedding the image URL directly into the email body using HTML.</p><p>⚠️<strong> Critical Security Note on Image Hosting:</strong></p><p>For all recipients to be able to view the image when they open the email, the Azure Blob Storage container hosting your birthday image <strong>must be set to Public Access.</strong></p><ul><li>Create a special container for this purpose.</li><li>Make the container public (<a href="https://learn.microsoft.com/en-us/azure/storage/blobs/anonymous-read-access-configure?tabs=portal">Read more here</a>).</li><li>Copy the image URL from your Azure Blob.</li></ul><p>Use the following basic <strong>HTML structure</strong> in the email body. Remember to edit the <strong>src URL</strong> to your specific public Azure Blob URL and customize the font configurations (color, size, etc.):</p><pre>&lt;p style=&quot;font-family: &#39;Century Gothic&#39;, sans-serif;&quot;&gt;<br>Dear @{items(&#39;Apply_to_each&#39;)?[&#39;FirstName&#39;]},<br>&lt;/p&gt;<br>&lt;img src=&quot;your_url_link_will_be_here&quot; alt=&quot;Happy Birthday&quot;/&gt;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JQ8Cnivr8dwBJBmr" /><figcaption>Email configuration in `send an email`</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/0*r8lE5ETAZ2pFy5hk" /></figure><h3>5. Completing the Automation: Audit and Tracking (Optional but Recommended)</h3><p>You have successfully configured the core birthday mail automation! The main goal — eliminating manual effort and celebrating your customers — has been achieved.</p><p>However, to truly master this process, consider adding audit and tracking steps. This ensures <strong>accountability </strong>and provides valuable <strong>data analytics</strong> on your automation’s performance.</p><h3>Recommended Audit Steps:</h3><ul><li><strong>Daily Success Counter</strong>: Add a step outside the “Apply to each” loop to increment a counter variable based on the number of emails sent (the length of the filtered array). This simple count can be logged daily.</li><li>OR <strong>Audit Trail Log</strong>: Inside the “Apply to each” loop, after the email is sent, use the “<strong>Add a row into a table</strong>” action to log the customer’s details (Name, Email, Date Sent) into a designated Audit Excel Sheet or Database table.</li></ul><p>This audit trail is crucial for:</p><ul><li>Troubleshooting: Quickly identifying any failed emails.</li><li>Reporting: Tracking the reach of your customer engagement efforts.</li></ul><h3>Output and Conclusion</h3><p>The result of this automation is a seamless, cost-effective, and highly personalized customer touchpoint. Every morning, without manual intervention, your customers receive a celebratory email, positioning <strong>Adefactory Limited </strong>as a company that truly values them.</p><p>If you found this guide helpful and are ready to unlock more time-saving solutions:</p><p>👍 <strong>Like </strong>this article to let me know the content is valuable. 💬 <strong>Comment </strong>below with your favorite Power Automate tip or any questions you have. 🔔 <strong>Follow </strong>me for more practical, step-by-step guides on Data Analytics and Power Platform automation!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=45543ef3be41" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Does Your Menu Dictate Your Ratings? A Machine Learning Answer]]></title>
            <link>https://medium.com/@adeboladesoyin/restaurants-cuisines-aggregate-rating-prediction-200341b51c92?source=rss-925986e9fe77------2</link>
            <guid isPermaLink="false">https://medium.com/p/200341b51c92</guid>
            <category><![CDATA[linear-regression]]></category>
            <category><![CDATA[restaurant-analytics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[predictions]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Adeboladesoyin]]></dc:creator>
            <pubDate>Fri, 28 Mar 2025 18:53:04 GMT</pubDate>
            <atom:updated>2025-04-03T09:54:18.924Z</atom:updated>
            <content:encoded><![CDATA[<h4>Restaurants’ Cuisines Rating Prediction</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*oeTYtJHM6tqRvzF3" /><figcaption>Photo by <a href="https://unsplash.com/@jaywennington?utm_source=medium&amp;utm_medium=referral">Jay Wennington</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3><strong>Introduction</strong></h3><p>Dining out is more than just a necessity — it’s an experience shaped by cuisine, ambiance, service, and location. In today’s data-driven world, restaurant owners and food platforms rely on predictive analytics to understand customer preferences and optimize their offerings.</p><p>This project, “<em>Restaurants’ Cuisines Rating Prediction,</em>” leverages machine learning to predict restaurant ratings based on key features such as: Cuisine types (e.g., Italian, Indian, Chinese), price range, availability and online delivery mode.</p><h3><strong>Objectives of the Project</strong></h3><ol><li>Analyze Cuisine-Rating Relationships: Identify which cuisines correlate with higher/lower ratings. Explore regional trends.</li><li>Feature Engineering: Transform categorical data into model-friendly features. Handle geo-spatial data (Latitude, Longitude) to infer location-based patterns.</li><li>Predictive Modeling: Train regression models (e.g., Linear Regression) to predict aggregate ratings.</li><li>Evaluate performance using metrics like RMSE and R²-score.</li><li>Give Actionable Insights and provide recommendations for restaurant owners.</li></ol><p><strong>Resources</strong></p><p>The dataset used for the analysis is gotten from GitHub and can be downloaded using <a href="https://raw.githubusercontent.com/Oyeniran20/axia_class_cohort_7/refs/heads/main/Dataset%20.csv">Dataset link</a>.</p><p><strong>Loading libraries and the dataset</strong></p><pre># Import important libraries for data exploration.<br>import pandas as pd<br>import numpy as np<br>import matplotlib.pyplot as plt<br>import seaborn as sns<br>from sklearn.model_selection import train_test_split<br>from sklearn.preprocessing import OneHotEncoder, StandardScaler<br># Import linear model regression<br>from sklearn.linear_model import LinearRegression<br><br><br>#using folium library will help to create a dynamic map, hence the install and import<br>!pip install folium<br>import folium<br>#importing the ,=marker cluster to seperate the coordinates according to their nearest city to each other<br>from folium.plugins import MarkerCluster<br>import plotly.express as px<br><br><br># Get the dataset link<br>url = &#39;https://raw.githubusercontent.com/Oyeniran20/axia_class_cohort_7/refs/heads/main/Dataset%20.csv&#39;<br><br># Read the dataset and get the top 5 rows<br>df = pd.read_csv(url)<br>df.head()</pre><h3><strong>1. Data Overview</strong></h3><p>Getting to understand the data is an important process in any data processing and modelling. It helps to know any data quality issues that should be considered in any pre-processing.</p><pre># Understanding the number of rows and columns that make up the dataset.<br>variablea = df.shape<br>print(f&#39;The number of rows are {variablea[0]} while the number of columns are {variablea[1]}&#39;)<br><br># understanding the data types of each columns in the dataset to determine if they are correct.<br>df.dtypes</pre><p>The number of rows are 9551 while the number of columns are 21.</p><p><strong>Missing Values</strong></p><pre># To check count of missing values in each column<br>missing_value = df.isna().sum().sort_values(ascending = False)<br><br># To get the % of the missing values for the columns in the dataset.<br>missing_pct = (df.isna().sum().sort_values(ascending = False)/ len(df)) *100<br><br>missing_df = pd.DataFrame ({&#39;Missing Values&#39;: missing_value,&#39;Missing Pct&#39;: missing_pct})<br>print(missing_df)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/420/1*pyNZDm15EAD1Gm2JiCkaXw.png" /><figcaption>Missing values Table</figcaption></figure><p>No duplicate records was observed int the dataset and the missing value for cuisine column only make up 0.09% which is not significant.</p><p><strong>Data Types</strong></p><pre># To check the information and constraints on each column alongside the dtypes<br>df.info()<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/421/1*9f5Upqny3Cx-QfC-WOWThw.png" /></figure><p><strong>Statistical summary of the Dataset</strong></p><pre># To check for the summary statistics of the data<br>df.describe().transpose()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/957/1*G-bS_4-451_YDnUvtlOCDQ.png" /></figure><h3><strong>2. Target Variable Analysis</strong></h3><p>The target variable —<em> Aggregate rating</em> showed a left skewed distribution with over 2000 occurences of 0. The skewness value is -0.95</p><pre># To plot the histogram distribution of the aggregate rating column<br>Skewness = df[&#39;Aggregate rating&#39;].skew()<br>print(f&quot;Skewness: {Skewness}&quot;)<br>plt.figure(figsize= (10,4))<br>plt.subplot(1,2,1)<br>sns.histplot(df[&#39;Aggregate rating&#39;],kde = True,bins=20, color = &#39;purple&#39; )<br>plt.title(&#39;The Average Rating Distribution&#39;, color = &#39;purple&#39;, fontweight = &#39;bold&#39;, fontsize = 20)<br>plt.xlabel(&#39;Average Rating&#39;)<br>plt.ylabel(&#39;Count&#39;)<br><br>plt.subplot(1,2,2)<br>sns.boxplot(x=df[&#39;Aggregate rating&#39;], color = &#39;purple&#39;)<br>plt.title(&#39;The Average Rating Boxplot&#39;, color = &#39;purple&#39;, fontweight = &#39;bold&#39;, fontsize = 20)<br>plt.xlabel(&#39;Average Rating&#39;)<br><br>plt.tight_layout()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SK9SRupq2myil3pReFRR2A.png" /></figure><p>The skewness was addressed by replacing the 0 with mean aggregate rating where df !== 0. After which, the distribution was re-plotted and skewness changed to 0.26 which lies in between the normal skewness value of -0.5 to 0.5.</p><p><strong>Class Imbalance</strong></p><p>The count of each rating was plotted and over 2000 records has 0 ratings</p><pre>plt.figure(figsize = (8,4))<br>sns.countplot(x= df[&#39;Aggregate rating&#39;], color = &#39;purple&#39;)<br>plt.xticks(rotation = 90, ha = &#39;right&#39;)<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/728/1*AreHqg0jJ-2arjPr8xdfpw.png" /><figcaption>Records of each aggregate rating</figcaption></figure><p>I addressed the feature imbalance by replacing the 0 rating with the average rating where the ratings are not 0.</p><pre># Replacing the outlier with the average rating, what&#39;s the total average rating<br>averagerating = df[df[&#39;Aggregate rating&#39;] != 0][&#39;Aggregate rating&#39;].mean()<br>#Replacing any occurenece of 0 with the average rating<br>df[&#39;Aggregate rating&#39;] = np.where(df[&#39;Aggregate rating&#39;]==0, averagerating, df[&#39;Aggregate rating&#39;])</pre><pre># To plot the histogram distribution of the aggregate rating column again after replacing the 0 with the mean of the average rating field.<br>Skewness = df[&#39;Aggregate rating&#39;].skew()<br>print(f&quot;Skewness: {Skewness}&quot;)<br>plt.figure(figsize= (10,4))<br>plt.subplot(1,2,1)<br>sns.histplot(df[&#39;Aggregate rating&#39;],kde = True,bins=20, color = &#39;purple&#39; )<br>plt.title(&#39;Average Rating Distribution After Addressing Imbalance&#39;, color = &#39;purple&#39;, fontweight = &#39;bold&#39;, fontsize = 10)<br>plt.xlabel(&#39;Average Rating&#39;)<br>plt.ylabel(&#39;Count&#39;)<br><br>plt.subplot(1,2,2)<br>sns.boxplot(x= df[&#39;Aggregate rating&#39;],color = &#39;purple&#39; )<br>plt.title(&#39;Average Rating Boxplot After Addressing Imbalance&#39;, color = &#39;purple&#39;, fontweight = &#39;bold&#39;, fontsize = 10)<br>plt.xlabel(&#39;Average Rating&#39;)<br><br>plt.tight_layout()<br>plt.show()</pre><p><em>Skewness after addressing Imbalance: </em><strong><em>0.26</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rUU082zmqBOosOqksLaVSQ.png" /></figure><h3><strong>3. Data Visualization &amp; Additional Insights</strong></h3><p>The dataset fields were categorized and separated into categorical and numerical columns. The categorical columns were analyzed using bar plot . The analysis shows the summary below:</p><pre># Looping through the categorical column that has lesser tha 10 unique values and greter than 1<br>cat_col2 = [&#39;Has Table booking&#39;, &#39;Has Online delivery&#39;, &#39;Is delivering now&#39;,<br>        &#39;Rating color&#39;, &#39;Rating text&#39;]<br>for y in cat_col2:<br>    plt.figure(figsize = (8,3))<br>    df[y].value_counts().plot(kind=&#39;bar&#39;, color=&#39;purple&#39;)<br>    # sns.histplot(df[y], kde= True, color =&#39;purple&#39;)<br>    plt.title(f&#39;{y} Distribution&#39;, fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 10)<br>    plt.xlabel(y)<br>    plt.ylabel(&#39;count&#39;)<br><br>plt.tight_layout()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/798/1*lJMXV-6QZqmjI2jS9OMheQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/909/1*rMSw38ArPiUhMPm5UJjdAg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/380/1*5IG5AAlzW5SoswSLtu0hLQ.png" /></figure><ul><li>Orange rating color has the highest frequency for most restaurants.</li><li>The rating is on the average for most restaurant which was as a result of aggregate rating of about 3.7.</li><li>Online delivery, table booking and delivery now features are majorly No.</li></ul><p>Top 5 Cuisines and City were analyzed and visualized which were dependent on the number of restaurants serving them and the number of restaurants in that city respectively.</p><h3><strong>Top 5 Cuisines</strong></h3><p>To analyze the top 5 cuisines, I will need to separate the cuisines using their delimiter (,) with the function explode on the feature.</p><pre># Split cuisines into individual items and explode the list by putting them in different row, spliting by delimeter &#39;,&#39;<br>df[&#39;Cuisines&#39;] = df[&#39;Cuisines&#39;].str.split(&#39;, &#39;)<br>df = df.explode(&#39;Cuisines&#39;)<br>df.head()</pre><pre>Top_5_Cuisines = df.groupby([&#39;Cuisines&#39;])[&#39;Restaurant ID&#39;].count().sort_values(ascending = False).head()<br>Top_5_Cuisines<br>#Visualizing the top 5 cuisines<br>plt.figure(figsize = (10,4))<br><br>Top_5_Cuisines.plot(kind = &#39;bar&#39;, color = &#39;purple&#39;)<br>plt.title(&#39;Top_5_Cuisines&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 10)<br>plt.xlabel(&#39;Cuisines&#39;)<br>plt.ylabel(&#39;Count&#39;)<br>plt.xticks(rotation = 0)<br><br>plt.tight_layout<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*wcwdoAEkH9jJFb-0yrP8Xw.png" /><figcaption>Top 5 Cuisines</figcaption></figure><h3><strong>Top 5 Cities</strong></h3><p>Average rating across the city were also analyzed to see the cities with the highest rating. This could be affected by the location of the restaurant and the type of cuisines offered the most by the restaurants in that city.</p><pre>Top_5_City = df.groupby([&#39;City&#39;])[&#39;Restaurant ID&#39;].count().sort_values(ascending = False).head()<br>Top_5_City</pre><pre>#Visualizing the top 5 Cities<br>plt.figure(figsize = (10,4))<br><br>Top_5_City.plot(kind = &#39;bar&#39;, color = &#39;purple&#39;)<br>plt.title(&#39;Top_5_Cities&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 10)<br>plt.xlabel(&#39;Cities&#39;)<br>plt.ylabel(&#39;Count&#39;)<br>plt.xticks(rotation = 0)<br><br>plt.tight_layout<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*KGFDp8-lJSfjNxBrakeoSg.png" /><figcaption>Top 5 Cities</figcaption></figure><h3><strong>Average ratings across cuisines and cities.</strong></h3><pre>#Getting the average rating across the cuisines<br>Cuisines_average_rating = df.groupby([&#39;Cuisines&#39;])[&#39;Aggregate rating&#39;].mean().sort_values(ascending = False).nlargest(10)<br>Cuisines_average_rating<br><br>#Visualizing the top 15 average rating across the cuisines<br>plt.figure(figsize = (10,4))<br><br>Cuisines_average_rating.plot(kind = &#39;bar&#39;, color = &#39;purple&#39;)<br>plt.title(&#39;Top 10 Cuisines by Average Aggregate Rating&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 10)<br>plt.xlabel(&#39;Cuisines&#39;)<br>plt.ylim(4, 5)<br>plt.ylabel(&#39;Average Aggregate Rating&#39;)<br>plt.xticks(rotation = 0)<br><br>plt.tight_layout<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/867/1*R5mZiq-l2wgccw-7eBIrJQ.png" /></figure><pre>#Getting the average rating across the Cities<br>Cities_average_rating = df.groupby([&#39;City&#39;])[&#39;Aggregate rating&#39;].mean().sort_values(ascending = False).nlargest(10)<br>Cities_average_rating<br><br>#Visualizing the top 15 average rating across the cities<br>plt.figure(figsize = (8,4))<br><br>sns.barplot(x=Cities_average_rating.values, y=Cities_average_rating.index, legend = False,color = &#39;purple&#39; )<br>plt.title(&#39;Top 10 Cities by Average Aggregate rating&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 10)<br>plt.xlabel(&#39;Avearge Aggregate Rating&#39;)<br>plt.xlim(4, 5)<br>plt.ylabel(&#39;Cities&#39;)<br>plt.xticks(rotation = 0)<br>for index, value in enumerate(Cities_average_rating.values):<br>  plt.text(value, index, f&#39;{value:.2f}&#39;, va=&#39;center&#39;, ha=&#39;left&#39;, fontsize=10, color=&#39;black&#39;)<br><br>plt.tight_layout<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/827/1*wpezl4Ipcbm2O3DIWVoZRQ.png" /></figure><p><strong>Observation</strong></p><ol><li>Highest-Rated Cities: Inner City leads with 4.90, followed by Quezon City (4.80) and Makati City (4.72). 5/10 cities are from the Philippines (e.g., Mandaluyong, Pasig, Taguig, Tagaytay). London is the only non-Asian city in the top 10.</li></ol><p><strong>Key Insight: </strong>Urban centers in the Philippines dominate high ratings, suggesting strong dining quality or cultural preference for rating restaurants highly.</p><p>2. Top Performers: Sunda (4.8), Börek (4.6), and Taiwanese (4.4) cuisines rank highest. Asian cuisines (Ramen, Dim Sum, Bubble Tea, Döner, Curry, Kebab) dominate the list.</p><p><strong>Key Insight: </strong>Asian and Middle Eastern cuisines consistently receive high ratings, likely due to flavor diversity or cultural authenticity. The 0.4-point range (4.8 to 4.4) indicates tight competition.</p><p>3. New Delhi has the highest restaurant count (10,000), dwarfing others. Gurgaon (8,000), Noida (6,000), and Faridabad (4,000) form a tiered drop.</p><p><strong>Key Insight: </strong>India’s National Capital Region (NCR) is a dense restaurant hub, with New Delhi as the clear leader. The 2.5x gap between New Delhi and Almeldabad suggests a centralized dining economy.</p><h3><strong>Map Distribution</strong></h3><p>folium library was used to visualize a map distribution of restaurants across different geographical areas.</p><pre>center_lat = df[&#39;Latitude&#39;].mean()<br>center_lon = df[&#39;Longitude&#39;].mean()<br>map = folium.Map(location=[center_lat, center_lon], zoom_start=4)<br>marker_cluster = MarkerCluster().add_to(map)<br>for index, record in map_df.iterrows():<br>    # Get the coordinates for each specific record<br>    coords = (record[&#39;Latitude&#39;], record[&#39;Longitude&#39;])<br>    restaurant_name = record[&#39;Restaurant Name&#39;]<br><br>    # Add a marker at the different coordinates<br>    folium.Marker(<br>        location=coords,<br>        popup=f&quot;Restaurant Name: {record[&#39;Restaurant Name&#39;]}&quot;,<br>        tooltip = f&quot;Restaurant Name: {record[&#39;Restaurant Name&#39;]}&lt;br&gt;Average rating: {record[&#39;Aggregate rating&#39;]}&lt;br&gt;City: {record[&#39;City&#39;]}&lt;br&gt; Location: {coords}&quot;<br>    ).add_to(marker_cluster)<br><br>map</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iXeJULzjhgWF8kYbgtjGsQ.png" /></figure><p><strong>Observation</strong></p><ul><li>I noticed India has the largest number of restaurant count with over 8,289</li><li>Also, noticed there are over 400 restaurants located in the atlantic ocean which signifies data error entries with their latitude and longitude. This indicates outliers with the coordinates.</li><li>Unites states has 468 restaurant and the lowest of 2 located in the Albany and bunbury.</li></ul><p>Additional analysis was conducted and the results shows:</p><ul><li>497 restaurants has 0 latitude and longitude outliers</li><li>New Delhi city has the most restaurants number (233) with the outliers latitude and longitude.</li></ul><p><strong><em>Effects may include: </em></strong>outlier affecting the correct distribution of the restaurants across the coordinates and causing misinformation of cities representation.</p><p>Relationship between Votes and aggregate rating was conducted and observation with the result shows:</p><pre>plt.figure(figsize = (12,4))<br>#plot a line chart to see the relationship between votes and rating<br>plt.subplot(1,3,1)<br>sns.lineplot(x = df[&#39;Aggregate rating&#39;],y = df[&#39;Votes&#39;], color =&#39;purple&#39;)<br>plt.title(f&#39;Relationship between Votes and Aggregate Rating&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 8)<br><br>plt.subplot(1,3,2)<br>sns.scatterplot(x = df[&#39;Aggregate rating&#39;],y = df[&#39;Votes&#39;], color =&#39;purple&#39;)<br>plt.title(f&#39;Votes Vs Aggregate Rating&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 8)<br><br>plt.subplot(1,3,3)<br>x= df[[&#39;Votes&#39;, &#39;Aggregate rating&#39;]]<br>corr = x.corr()<br>sns.heatmap(corr,cmap= &#39;vanimo&#39;, annot= True)<br>plt.title(f&#39;Votes Vs Aggregate Rating Correlation&#39;,fontweight = &#39;bold&#39;, color =&#39;purple&#39;, fontsize = 8)<br><br>plt.tight_layout()<br>plt.show()<br>There is a positive (+ve) realtionship between votes and rating given a steady increase in the line chart.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZqIGFi0OkpFUgJDtSfD2g.png" /></figure><ul><li>It can be said that more people votes for higher rating (3.5–5.0) compared to the lower rating between 2 and 3.4.</li><li>As the rating goes higher, the number of votes also goes up.</li><li>However, there was a sharp decline at the rating of 1.9 from 1.8. the sharp decline can be explained by number of factors as there was no much obvious difference between rating 1.8 and 1.9. This might be due to people’s taste of cuisines served or other factors of satisfaction derived.</li><li>There is a weak positive correlation between votes caste and the aggregate rating for each restaurants which explains the lower ratings relationship to lower votes.</li></ul><p><strong>Table Booking Impact Analysis was conducted to </strong>determine if table booking availability affects ratings across different cities and also compare average ratings with and without this feature. Also, the percentage of restaurants offering delivery was analyzed and result showed the percentage of restaurant offering online delivery is 25.7%.</p><pre>#Get the three necessary ciolumns for this task<br>table_booking = df[[&#39;City&#39;,&#39;Aggregate rating&#39;,&#39;Has Table booking&#39;]]<br>table_booking<br><br>#Average rating with the feature (Has Table booking) in a dataframe<br>table_booking.groupby([&#39;City&#39;, &#39;Has Table booking&#39;])[&#39;Aggregate rating&#39;]. mean().sort_values(ascending = False).unstack()<br>table_booking.groupby([&#39;City&#39;, &#39;Has Table booking&#39;])[&#39;Aggregate rating&#39;]. mean().sort_values(ascending = False).nlargest(10).unstack().plot(kind = &#39;bar&#39;)<br><br>#Comparing average rating with the feature (Has Table booking)<br>table_booking_average_rating = df[[&#39;Has Table booking&#39;, &#39;Aggregate rating&#39;]]<br>table_booking_average_rating.groupby([&#39;Has Table booking&#39;])[&#39;Aggregate rating&#39;].mean().plot(kind = &#39;bar&#39;, color = &#39;purple&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/608/1*dmnn3DFU_IdXrRurcJdgqg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*Okz8Pf_R6SOPoGTYfD5LJg.png" /><figcaption>Table booking impact analysis by the Author</figcaption></figure><p><strong>Percentage of restaurant offering online delivery</strong></p><pre>#Filter only the rows that has online delivery<br>Online_delivery = dor[dor[&#39;Has Online delivery&#39;] == &#39;Yes&#39;]<br><br>#Count the rows that has the online delivery<br>online_delivery_count = Online_delivery.shape[0]<br>online_delivery_count<br><br>#To get the total count of the whole dataset.<br>restaurant_count = dor.shape[0]<br>restaurant_count<br><br>#Get the pct of the restaurant that has online delivery<br>restaurant_online_delivery_pct = (online_delivery_count/restaurant_count) *100<br>print (f&#39;The percentage of restaurant offering online delivery is {restaurant_online_delivery_pct:.1f}%&#39;)</pre><pre>The percentage of restaurant offering online delivery is 29.4%</pre><p>Observation reflected</p><ul><li>Table booking has more effect on the aggregate rating by customer for restaurants.</li><li>The more the restaurant has table booked. Customers seems to enjoy services more, hence, the high rating.</li></ul><p><strong>Availability across different price ranges using Has Online booking feature</strong></p><pre># I assume that Has Online delivery is my availability column (avcol1)<br>avcol1 = &#39;Has Online delivery&#39;<br>df1 = df[[&#39;Restaurant Name&#39;, &#39;Restaurant ID&#39;,&#39;Has Online delivery&#39;, &#39;Price range&#39;]]<br><br># grouping by the availability column for the different price range<br>availability_analysis = df1.groupby(&#39;Price range&#39;)[avcol1].value_counts(normalize=True).unstack() * 100<br><br># I would like to rename the yes and NO to percentage offering delivery and pct not offering delivery<br>availability_analysis = availability_analysis.rename(columns={&#39;Yes&#39;: &#39;Percentage Offering Delivery&#39;, &#39;No&#39;: &#39;Percentage Not Offering Delivery&#39;})<br><br># plot the graph<br>plt.figure(figsize = (8,5))<br>availability_analysis[&#39;Percentage Offering Delivery&#39;].plot(kind=&#39;bar&#39;, color=&#39;purple&#39;, edgecolor=&#39;red&#39;)<br>plt.title(&#39;Percentage of Restaurants Offering Delivery by Price Range&#39;, fontweight = &#39;bold&#39;)<br>plt.xlabel(&#39;Price Range&#39;)<br>plt.ylabel(&#39;Percentage Offering Delivery&#39;)<br>plt.xticks(rotation=0)<br>#I would like to see the data label<br>for index, value in enumerate(availability_analysis[&#39;Percentage Offering Delivery&#39;]):<br>    plt.text(index, value, f&#39;{value:.2f}%&#39;, va=&#39;bottom&#39;, ha=&#39;center&#39;, fontsize=10, color=&#39;black&#39;)<br>plt.show()<br>availability_analysis</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/760/1*zblAEepMkqFZ62spHYlh1A.png" /><figcaption>pct of restaurants offering delivery by price range — Image by Author</figcaption></figure><p><strong>Analyze availability across different price ranges using Is delivering now feature.</strong></p><pre># I assume that Has Online delivery is my availability column (avcol1)<br>avcol2 = &#39;Is delivering now&#39;<br>df2 = df[[&#39;Restaurant Name&#39;, &#39;Restaurant ID&#39;,&#39;Is delivering now&#39;, &#39;Price range&#39;]]<br><br># grouping by the availability column for the different price range<br>availability_analysis2 = df2.groupby(&#39;Price range&#39;)[avcol2].value_counts(normalize=True).unstack() * 100<br><br># I would like to rename the yes and NO to percentage offering delivery and pct not offering delivery<br>availability_analysis2 = availability_analysis2.rename(columns={&#39;Yes&#39;: &#39;Percentage Delivering Now&#39;, &#39;No&#39;: &#39;Percentage Not Delivering Now&#39;})<br><br># plot the graph<br>plt.figure(figsize = (8,5))<br>availability_analysis2[&#39;Percentage Delivering Now&#39;].plot(kind=&#39;bar&#39;, color=&#39;purple&#39;, edgecolor=&#39;red&#39;)<br>plt.title(&#39;Percentage of Restaurants Delivering Now by Price Range&#39;, fontweight = &#39;bold&#39;)<br>plt.xlabel(&#39;Price Range&#39;)<br>plt.ylabel(&#39;Percentage Delivering Now&#39;)<br>plt.xticks(rotation=0)<br>#I would like to see the data label<br>for index, value in enumerate(availability_analysis2[&#39;Percentage Delivering Now&#39;]):<br>    plt.text(index, value, f&#39;{value:.2f}%&#39;, va=&#39;bottom&#39;, ha=&#39;center&#39;, fontsize=10, color=&#39;black&#39;)<br>plt.show()<br><br>availability_analysis2</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*NBk06v30Il5gOEgNPlSIbA.png" /><figcaption>pct of restaurants offering delivering now across different price range — Image by Author</figcaption></figure><p><strong>Observations for Online Delivery Analysis: </strong>Analysing availability across different price ranges using “Has Online booking” and “Is delivering now” columns shows that:</p><ul><li>The percentage of restaurant offering online delivery is 29.4%</li><li>Out of this 29.4 % of them, 45% of them has price range of 2 while 31% has price range of 3.</li><li>Less than 1% of the restaurants is delivering now and only 0.9% of has price range of 2</li></ul><p><strong>Customer Preferences</strong></p><p>Specific cuisines that consistently receive higher ratings were identified and the result shows American, Italian, continental amongst others having receive higher ratings multiple times.</p><pre># Get the average rating per cuisine<br>cuisine_ratings = Cuisines_consistent.groupby(&#39;Cuisines&#39;)[&#39;Aggregate rating&#39;].agg([&#39;mean&#39;, &#39;count&#39;]).reset_index().rename(columns={&#39;mean&#39;: &#39;Average Rating&#39;, &#39;count&#39;: &#39;Restaurant Count&#39;})<br><br># Filter cuisines with above 300 restaurant count<br>cuisine_ratings = cuisine_ratings[cuisine_ratings[&#39;Restaurant Count&#39;] &gt;= 300].sort_values(by= [&#39;Restaurant Count&#39;], ascending = True)<br>cuisine_ratings</pre><pre>plt.figure(figsize = (12, 8))<br><br># Create the horizontal bar plot<br>bars = plt.barh(cuisine_ratings[&#39;Cuisines&#39;],cuisine_ratings[&#39;Restaurant Count&#39;],color = &#39;purple&#39;,height=0.7)<br><br># Customize title and labels<br>plt.title(&#39;Cuisines with Highest Ratings and Restaurant Counts&#39;,color = &#39;purple&#39;,fontweight = &#39;bold&#39;,pad=20)<br>plt.xlabel(&#39;Number of Restaurants (Count)&#39;)<br>plt.ylabel(&#39;Cuisine Type&#39;)<br><br># Calculate the maximum bar width for positioning<br>max_width = max(cuisine_ratings[&#39;Restaurant Count&#39;])<br><br># Add data labels (counts and ratings)<br>for bar in bars:<br>    width = bar.get_width()<br>    y_pos = bar.get_y() + bar.get_height()/2<br>    <br>    # Restaurant Count (inside bar, right-aligned)<br>    plt.text(width - 5, y_pos, f&#39;{int(width)}&#39;, va=&#39;center&#39;, ha=&#39;right&#39;, fontsize=10, color=&#39;white&#39;, fontweight=&#39;bold&#39;    )<br>    <br>    # Average Rating (outside bar, aligned with counts)<br>    cuisine_name = cuisine_ratings.iloc[int(y_pos)][&#39;Cuisines&#39;]<br>    rating = cuisine_ratings.loc[cuisine_ratings[&#39;Cuisines&#39;] == cuisine_name, &#39;Average Rating&#39;].values[0]<br>    # Added star symbol for clarity<br>    plt.text(width + 0.05*max_width, y_pos, f&#39;  {rating:.1f} ★&#39;, va=&#39;center&#39;, ha=&#39;left&#39;, fontsize=10, color=&#39;black&#39;)<br><br># Adjust margins and layout<br>plt.grid(axis=&#39;x&#39;, linestyle=&#39;--&#39;, alpha=0.6)<br>plt.tight_layout()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9W3h4qxi2hS_cgO1SAmqpA.png" /></figure><p>North Indian cuisines are more preferred in the Asia part of the continent including New Delhi, Noida, Gurgaon etc.,</p><pre>city_specific = df[[&#39;Cuisines&#39;, &#39;City&#39;, &#39;Restaurant ID&#39;]]<br>city_specific_group = city_specific.groupby([&#39;City&#39;, &#39;Cuisines&#39;])[&#39;Restaurant ID&#39;].count().reset_index(name = &#39;Restaurant Count&#39;)<br>city_specific_pref= city_specific_group.sort_values(by = [&#39;City&#39;, &#39;Restaurant Count&#39;],ascending = [True, False])<br>city_specific_preference= city_specific_pref.groupby(&#39;City&#39;).head(1).reset_index(drop=True)<br>city_specific_preference = city_specific_preference.sort_values(by = &#39;Restaurant Count&#39;, ascending = False)<br>city_specific_preference</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*abBwp2Z4G7YO0rFHcdUZJg.png" /></figure><h3><strong>4. Predictive Modelling</strong></h3><p>Based on the training data, we will apply Linear regression model (is an algorithm that maps the input variable(s) to a single output variable in a linear format) to predict the outcome of the aggregate rating for the restaurants based on factors such as delivery, booking, cuisines, location/city etc.,</p><p><strong>Data preprocessing</strong></p><p>Defining the categorical and numerical columns</p><pre># Defining my categorical and numerical columns<br>cat_colp = df2.select_dtypes(include = [&#39;object&#39;]).columns<br>num_colp = df2.select_dtypes(include= np.number).columns<br>num_colp = num_colp[num_colp != &#39;Aggregate rating&#39;]<br>print(cat_colp)<br>print(num_colp)</pre><p><strong>Test and Train data</strong></p><pre>x= df2.drop(columns = [&#39;Aggregate rating&#39;])<br>y = df2[&#39;Aggregate rating&#39;]</pre><p><strong><em>Data Splitting</em></strong><br>The data were split into train and test data, “train_test_split”was imported to splits the data in an 80:20 ratio. 80% for train data and 20% for test data.</p><pre><br>x_train, x_test, y_train, y_test = train_test_split(x,y, test_size=0.2, random_state= 42)</pre><p><strong>Encoding &amp; Scaling</strong></p><p>Encoding refers to the process of converting categorical data to numerical format so it can be useful for algorithm to process. OneHotEncoder was used to transform the categorical columns to a more syatem usable format. while the StandaradScaler was used to scale down all the numerical columns to the same range of data for machine learning processing.</p><pre>#Encoding the cat_colp for the train data<br>x_train_cat = encoder.fit_transform(x_train[cat_colp])<br>x_test_cat = encoder.transform(x_test[cat_colp])</pre><pre>x_train_cat.toarray()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/369/1*zI38x2SFkPPDbs3ZQzEhFg.png" /></figure><pre>num_colp<br><br>scaler = StandardScaler()<br><br><br># scaling the num columns<br>x_train_num = scaler.fit_transform(x_train[num_colp])<br>x_test_num = scaler.transform(x_test[num_colp])</pre><pre>Index([&#39;Restaurant ID&#39;, &#39;Longitude&#39;, &#39;Latitude&#39;, &#39;Price range&#39;, &#39;Votes&#39;], dtype=&#39;object&#39;)</pre><p>numpy hstack was used to merge and process the encoded categorical and scaled numerical columns together and prepared for model prediction.</p><pre># Combining the categorical and numerical columns<br>x_train_processed = np.hstack((x_train_num, x_train_cat.toarray()))<br>x_test_processed = np.hstack((x_test_num, x_test_cat.toarray()))</pre><p><strong>Model Selection — Linear Regression</strong></p><p><strong>Training the Model using Train data</strong></p><pre># Import linear model regression<br>from sklearn.linear_model import LinearRegression<br>model = LinearRegression()<br><br>model.fit(x_train_processed, y_train)</pre><p><strong>Making Predictions — Testing the Model using Test data</strong></p><pre>y_train_pred = model.predict(x_train_processed)<br>y_test_pred = model.predict(x_test_processed)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*UO7UVDdXAMgTuEL0lHVu1g.png" /></figure><p><strong>Model Selection — Decision Tree Regression</strong></p><pre>from sklearn.tree import DecisionTreeRegressor<br>model2 = DecisionTreeRegressor()<br><br><br>model2.fit(x_train_processed, y_train)</pre><pre>y_train_pred2 = model2.predict(x_train_processed)<br>y_test_pred2 = model2.predict(x_test_processed)<br>print(y_train_pred2)<br>print(y_test_pred2)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/520/1*Aufq0tuRNwkuMC5hEvjOjQ.png" /></figure><p>Model Selection — Random Forest Regression</p><pre>from sklearn.ensemble import RandomForestRegressor<br>model3 = RandomForestRegressor()<br><br><br>model3.fit(x_train_processed, y_train)</pre><pre>y_train_pred3 = model3.predict(x_train_processed)<br>y_test_pred3 = model3.predict(x_test_processed)<br>print(y_train_pred3)<br>print(y_test_pred3)</pre><h3><strong>5. Model Evaluation</strong></h3><p>Two regression metrics were used in evaluating the model which are r2 score and mean square error.</p><pre># Regression metrics<br># Evaluating my model, I import r2score and mean square error<br>from sklearn.metrics import r2_score, mean_squared_error</pre><p>Evaluating the models using r2 score to get the train and test score</p><pre># predict the y train and y test value after modeling <br>train_score = r2_score(y_train_pred, y_train)<br>test_score = r2_score(y_test_pred, y_test)<br><br># For DecisionTreeRegressor<br>train_score_DecisionTree = r2_score(y_train_pred2, y_train)<br>test_score_DecisionTree = r2_score(y_test_pred2, y_test)<br><br>#For RandomForest regression<br>train_score_Randomforest = r2_score(y_train_pred3, y_train)<br>test_score_Randomforest = r2_score(y_test_pred3, y_test)</pre><pre>print (f&#39;train_score: {train_score}&#39;)<br>print (f&#39;test_score: {test_score}&#39;)<br><br>print (f&#39;train_score_DecisionTree: {train_score_DecisionTree}&#39;)<br>print (f&#39;test_score_DecisionTree: {train_score_DecisionTree}&#39;)<br><br>print (f&#39;train_score_Randomforest: {train_score_Randomforest}&#39;)<br>print (f&#39;test_score_Randomforest: {train_score_Randomforest}&#39;)</pre><pre>train_score: 0.8586656081238654<br>test_score: 0.8515391533304666<br>train_score_DecisionTree: 1.0<br>test_score_DecisionTree: 1.0<br>train_score_Randomforest: 0.9941458440972837<br>test_score_Randomforest: 0.9941458440972837</pre><pre># Deriving the mean square error for the prediction of the y train and y test value.<br>train_mse = mean_squared_error(y_train_pred, y_train)<br>test_mse = mean_squared_error(y_test_pred, y_test)<br><br><br>train_mse_DecisionTree = mean_squared_error(y_train_pred2, y_train)<br>test_mse_DecisionTree = mean_squared_error(y_test_pred2, y_test)<br><br>train_mse_Randomforest = mean_squared_error(y_train_pred3, y_train)<br>test_mse_Randomforest = mean_squared_error(y_test_pred3, y_test)</pre><pre>train mse linear regression: 0.03207323746749771<br>test mse linear regression: 0.03288849426350464<br>train mse decision tree: 2.1615241442517925e-27<br>test_mse decision tree: 0.017724505327245052<br>train mse random forest: 0.0014676676543705126<br>test mse random forest: 0.010826756118314265</pre><p><strong>Actual Vs Predicted</strong></p><pre># Plot the Actual Vs Target value for each model used for prediction<br># - y_train (actual training targets)<br># - y_test (actual test targets)<br># - Predictions: y_train_pred, y_test_pred (Linear Regression)<br>#                y_train_pred2, y_test_pred2 (Decision Tree)<br>#                y_train_pred3, y_test_pred3 (Random Forest)<br><br>plt.figure(figsize=(15, 5))<br><br># 1. Linear Regression<br><br>plt.subplot(1, 3, 1)<br>plt.scatter(y_test, y_test_pred, alpha=0.4, color=&#39;purple&#39;, label=&#39;Predictions&#39;)<br>plt.plot([y_test.min(), y_test.max()], [y_test.min(), y_test.max()], &#39;k--&#39;, lw=1, label=&#39;Perfect Fit&#39;)<br>plt.xlabel(&#39;Actual Values&#39;)<br>plt.ylabel(&#39;Predicted Values&#39;)<br>plt.title(&#39;Linear Regression (Test)\n$R^2$ = {:.3f}&#39;.format(r2_score(y_test, y_test_pred)))<br>plt.legend()<br>plt.grid(True, linestyle=&#39;--&#39;, alpha=0.7)<br><br># 2. Decision Tree<br><br>plt.subplot(1, 3, 2)<br>plt.scatter(y_test, y_test_pred2, alpha=0.4, color=&#39;red&#39;, label=&#39;Predictions&#39;)<br>plt.plot([y_test.min(), y_test.max()], [y_test.min(), y_test.max()], &#39;k--&#39;, lw=1, label=&#39;Perfect Fit&#39;)<br>plt.xlabel(&#39;Actual Values&#39;)<br>plt.title(&#39;Decision Tree (Test)\n$R^2$ = {:.3f}&#39;.format(r2_score(y_test, y_test_pred2)))<br>plt.legend()<br>plt.grid(True, linestyle=&#39;--&#39;, alpha=0.7)<br><br># 3. Random Forest<br><br>plt.subplot(1, 3, 3)<br>plt.scatter(y_test, y_test_pred3, alpha=0.4, color=&#39;green&#39;, label=&#39;Predictions&#39;)<br>plt.plot([y_test.min(), y_test.max()], [y_test.min(), y_test.max()], &#39;k--&#39;, lw=1, label=&#39;Perfect Fit&#39;)<br>plt.xlabel(&#39;Actual Values&#39;)<br>plt.title(&#39;Random Forest (Test)\n$R^2$ = {:.3f}&#39;.format(r2_score(y_test, y_test_pred3)))<br>plt.legend()<br>plt.grid(True, linestyle=&#39;--&#39;, alpha=0.7)<br><br>plt.tight_layout()<br>plt.show()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Td6kNm3yvBcX3nJKcZGDRA.png" /><figcaption>Actual Vs Predicted values — Image by Author</figcaption></figure><p>Kindly find the link to the script here: <a href="https://github.com/Adesoyin/Restaurants-Cuisines-Aggregate-Rating-Prediction/blob/main/Data%20Science%20in%20Restaurant%20Analytics.ipynb">GitHub</a></p><h3>6. Model Performance Analysis</h3><p><strong>Comparative Performance Summary ( </strong>R² Scores (Higher is better), MSE Scores (Lower is better))</p><ol><li><strong>Predictive Performance</strong>:</li></ol><ul><li>The Linear Regression model achieved high <strong>R² scores</strong> (~0.85 for both train and test sets), indicating it explains 85% of rating variability.</li><li>Perfect scores (1.0) indicate severe over-fitting using the Decision forest model. Near-perfect scores (0.994) with minimal train-test gap for Random forest model.</li><li>Low <strong>Mean Squared Error (MSE ~0.03)</strong> suggests accurate predictions and the test MSE of 0.0329 showed consistent performance. With Random Forest, train MSE of 0.0015 and test MSE of 0.0107 shows best balance of performance and generalization</li></ul><p><strong>2. Fitting</strong>:</p><ul><li>Similar train/test scores (0.858 vs. 0.851) show the Linear regression model generalizes well to unseen data. However, overfitting is evident in Decision Tree.</li></ul><p><strong>3. Practical Utility</strong>:</p><ul><li>Predictions (e.g., ratings between 2.4–4.6) align with real-world scales (1–5 stars), making the model actionable.</li></ul><h4>Recommendations</h4><ol><li><strong>Feature Optimization</strong>:</li></ol><ul><li>The <strong>Decision Tree</strong> in its current form due to clear over-fitting, though pruning or depth limitation might help</li><li>Experiment with <strong>additional model and non-linear models ( XGBoost)</strong> to capture complex cuisine-location interactions.</li><li>Add <strong>sentiment analysis</strong> of reviews to improve accuracy.</li></ul><p><strong>2. Business Actions</strong>:</p><ul><li><strong>For Restaurants</strong>: Use predictions to identify under performing cuisines or locations needing menu/price adjustments.</li><li><strong>For Platforms</strong>: Integrate the model into recommendation engines to highlight high-potential restaurants.</li></ul><h3><strong>Conclusion</strong></h3><p>The Random Forest’s 0.2% performance drop from train to test (compared to 0.7% for Linear Regression) suggests it’s the most robust choice for this dataset. Random Forest is the best model with an R² of 0.958, explaining 95.8% of the variance with reasonable generalization (test MSE 0.0107).</p><p>Decision Tree performs well (R² = 0.930) but is over-fitting.</p><p>Linear Regression is the simplest model with decent performance (R² = 0.870).</p><p><em>Please feel free to check out my profile,, and other articles, and reach out to me on </em><a href="http://www.linkedin.com/in/adeboladesoyin"><em>LinkedIn</em></a><em>.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=200341b51c92" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Wide World Importer Analysis — Microsoft Fabric End-End Project- Shortcut, Dataflow, & Data…]]></title>
            <link>https://medium.com/@adeboladesoyin/wide-world-importer-analysis-microsoft-fabric-end-end-project-shortcut-dataflow-data-32f49ef60d65?source=rss-925986e9fe77------2</link>
            <guid isPermaLink="false">https://medium.com/p/32f49ef60d65</guid>
            <category><![CDATA[dataflow]]></category>
            <category><![CDATA[data-ingestion]]></category>
            <category><![CDATA[microsoft-fabric]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[power-bi]]></category>
            <dc:creator><![CDATA[Adeboladesoyin]]></dc:creator>
            <pubDate>Mon, 05 Aug 2024 10:51:44 GMT</pubDate>
            <atom:updated>2024-08-05T15:15:53.396Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>Wide World Importer Analysis — Microsoft Fabric End-End Project- Shortcut, Dataflow, &amp; Data Pipeline Ingestion.</strong></h3><p>Interested in understanding some of the different methods of data ingestion in Microsoft Fabric? If yes, explore with me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0ua2hdUayqvkSdUO6zajRQ.png" /><figcaption><em>Wide-World Importer Microsoft Fabric End-End Project — Image by Author</em></figcaption></figure><p>This project outlines the end-to-end analysis of the wide world imports of various products to different countries. It encompasses the different aspects of Microsoft Fabric (a SAAS platform for data ingestion, ETL, business intelligence reporting, and real time analytics) encompassing data engineering, data factory and data analytics.</p><p><strong>Four things were taken into consideration in this project which are;</strong></p><p>1. Data Ingestion</p><p>2. Data Transformation</p><p>3. Data modelling, and</p><p>4. Data visualization</p><p><strong>Purpose of the Project</strong></p><p>To ingest data into a newly created Lakehouse (a storage that hold both structured and unstructured data) using various methods, transforming the data using dataflow Gen2 and finally creating a compelling story via data visualization using Microsoft Fabric Power BI.</p><p><strong>Data Sources</strong></p><p><strong>Seven data tables were used for this project analysis;</strong></p><blockquote>1. FactOrders data — CSV file</blockquote><blockquote>2. OrderDetails data — CSV file</blockquote><blockquote>3. Shippers data -CSV file</blockquote><blockquote>4. Product data — XLSX file</blockquote><blockquote>5. Categories data -CSV file</blockquote><blockquote>6. Date table — CSV file</blockquote><blockquote>7. Customers table — XLSX file</blockquote><p><strong>A.</strong> <strong>Data Ingestion to Lakehouse</strong></p><blockquote>Data Engineering was switched to in Microsoft Fabric and a new Lakehouse named <em>“FabricProjetLakehouse”</em> was created into a folder created in a workspace. Four (4) different ways was used in getting the data to the created Lakehouse located in a workspace newly created on Microsoft fabric</blockquote><p><strong>Method 1: Shortcut from a warehouse –</strong></p><p>This method avoids the duplication of tables. To achieve this, a new data warehouse was created named “<strong>FB_Warehouse</strong>” and dataflow Gen2 was used to ingest the “FactOrders” csv file into the warehouse using import from text/csv file button as seen below. The table was named <strong>“FB_FactOrders”</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*iUYQfB-4EX4hhV25MEvTzQ.png" /><figcaption><strong>Image 1a: </strong>Ingestion of FactOrders table into the warehouse using dataflow Gen2</figcaption></figure><p>After this has been done, in my new Lakehouse, I clicked on new shortcut to get the data from the warehouse to the Lakehouse, selected the internal sources since the warehouse is located inside Fabric. I navigated my way to the warehouse destination to select the FB_FactOrders for creation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*LI0Fa1S5L9YmZmx66E34yA.png" /><figcaption><strong>Image 1b:</strong> Ingestion of FactOrders using Shortcut from the warehouse to Lakehouse -Image by Author</figcaption></figure><p><strong>Method 2: Ingestion using upload files (Shippers, categories and Date CSV files)</strong></p><p>This method ensured all CSV dim files were uploaded from the local machine or rather can be uploaded on the OneDrive and selected from therein.</p><p><em>However, note that it’s only CSV files that can be loaded into table section of the Lakehouse, while the file section can be used to store other files format.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*B9SZDTK6cwPrpyMP-E7wdQ.png" /><figcaption><strong>Image 2a:</strong> Upload of CSV files data into Microsoft Fabric Lakehouse — Image by Author</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*aVkP8QijNEofn-XVnSaFvA.png" /><figcaption><strong>Image 2b: </strong>Files are loaded as Delta tables in the Table section of the Lakehouse- Image by Author</figcaption></figure><p>After successful upload as files into the File section, they were loaded as delta tables into the Table section of the Lakehouse.</p><p><strong>Method 3: Ingestion using data factory pipeline -</strong></p><p>This method was used to get the OrderDetails table from SQL database to the Lakehouse.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dDsNB7_59zLQWpJMx-nbug.png" /><figcaption><strong>Image 3a:</strong> Querying of the OrderDetails table on SSMS database before ingestion to Microsoft Fabric Lakehouse — Image by Author</figcaption></figure><p>In the Lakehouse, I created a new pipeline and get data using copy data. I selected SQL database, and a new connection setting was configured using server name, database name and password as seen below.</p><p>After this has been done, I exited and selected the copy data assistant in pipeline, I ensured there is no encryption of data selected in the edit button pop up of the settings as shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*p8jBgrY3CignhZ8n5gPCLg.png" /><figcaption><strong>Image 3b:</strong> Edit connection to remove encrypted connection — Image by Author</figcaption></figure><p>I selected the manual entry of table name as written in my SQL database after which I previewed the data. In the destination settings, A new table name was created as WW1_OrderDetails In my Lakehouse and loaded which might take some minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*wC1MdabtpkyC-Pa478vvnw.png" /><figcaption><strong>Image 3c:</strong> Edit the source settings and enter manually the table name and preview data</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*nxh18E6fpKn9pW--he6rxA.png" /><figcaption><strong>Image 3d: </strong>Pipeline successfully created and run — Image by Author</figcaption></figure><p><strong>Method 4: Ingestion using dataflow Gen2 for all XLSX file (Products and Customers)</strong></p><p>Since the xlsx file could not be uploaded and loaded directly to the Lakehouse, the get data option using dataflow Gen2 was used to ingest the customers and products table. This is also like the power query we have on Power BI desktop. I changed the data type of all columns after loading for transformation. I then ensured that the correct Lakehouse was selected as the destination of the tables. They were renamed as FB_Products and WW1_customers respectively.</p><p><strong>B. Transformations in Data Flow Gen2</strong></p><p>The FB_OrderDetails, FB_Product and FB_Categories were loaded to dataflow for data normalization. This was necessary as the categories table could only reference the product table using productID key but when used as a slicer/filter, it reveals no active relationship with the OrderDetails table. In other word, the categories table could not be used to filter the OrderDetails . Hence, the need for the normalizations restructuring.</p><p><strong>Steps taken</strong></p><ol><li>The FB_categories table was collapsed to the product table using merge queries option (Left join product to categories to add the categoryname, category description and picture url fields to the product table.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1CZ-f-OpemCX8_Horsodg.png" /><figcaption><strong>Image 4a:</strong> Merging Queries Transformation in Dataflow Gen2 (FB_Categories &amp; FB_Product)</figcaption></figure><p>2. Merged the new FB_Product to the FB_OrderDetails table using Left join on productid. The categoryID was returned as a new field in the FB_Orderdetails which was later reloaded to Lakehouse as Silver_FB_OrderDetails.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*byexNFpfCCZf2cE3GmPNhQ.png" /><figcaption><strong>Image 4b: </strong>Merging Queries Transformation in Dataflow Gen2 (FB_OrderDetails &amp; FB_Product)</figcaption></figure><p>3. Ensure to select the data destination by selecting the Lakehouse and click on existing table if already created, else write a new table name.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_iVu8S50MGO912CIDb_fzg.png" /><figcaption><strong>Image 4c</strong>: Choose data destination to be loaded into either new/existing table in the Lakehouse</figcaption></figure><p><em>In my case, the table existed, replace existing table was selected and settings saved.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wzZ5iXow19VpIa6UjDbWaA.png" /><figcaption><strong><em>Image 4d:</em></strong> Update method either to append or replace data in the destination target</figcaption></figure><p>The new tables named Silver_OrderDetail and Silver_FB_Product were loaded back to the Lakehouse</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/603/1*UYUPGQwdcvAwyz2CAFkSBA.png" /><figcaption><strong>Image 4e:</strong> The new look of the FabricProjectLakehouse after all ingestion method has been used</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HWAL1rDckzUOI4vkENJ4dQ.png" /><figcaption><strong>Image 4f: </strong>Querying from the Lakehouse SQL endpoint — Image by Author</figcaption></figure><p><em>You can choose to switch to query to run some queries from the table as seen above before modeling.</em></p><p><strong>C. Data Modeling</strong></p><p>I switched to the SQL Analytics endpoint and clicked on the model tab where 5 relationships were built amongst the tables.</p><p>1. One to many from FB_shippers to FB_FactOrders on ShipperID key</p><p>2. One to many from FB_Date to FB_FactOrders on OrderDate key</p><p>3. One to many from FB_FactOrders to Silver_FB_OrderDetails on OrderID key</p><p>4. One to many from Silver_FB_product to Silver_FB_OrderDetails on ProductID key</p><p>5. One to many from FB_Customers to FB_FactOrders on customerID key</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JDAQKxixi29fc-jrIWQ7_w.png" /><figcaption><strong>Image 5:</strong> Data modelling in Microsoft Fabric — Image by Author</figcaption></figure><p>The relationship between the tables maintains a snowflake schema structure. DAX (Data analysis expressions) Measures were created including Total sales, Total quantity, Total Orders, Average Turn around Time (TAT) for product delivery etc.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*58g1kPFKecXcl0vaRdf1hw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mXwXBYPldRTklINeZqmKKg.png" /><figcaption><strong>Image 6a:</strong> Some basic DAX Measure written</figcaption></figure><p><em>Ensure that the measure button is not greyed out when trying to create one. If it is, then go to “</em><strong><em>manage default semantic model”.</em></strong><em> All tables to be used in your reporting should be made active and can also select all tables if they are necessary — click okay. With this, new measure button shouldn’t be grey out any longer.</em></p><p><strong>D. Data Visualization</strong></p><p>Power BI was switched to start the creation of report for insights. I clicked on “New Report” and started with getting to know the summary of the data. <br>The below report was created and can also be interacted with using this <a href="https://app.powerbi.com/view?r=eyJrIjoiM2NlNDc5MTQtMzlhNS00NjEzLWEwMDAtMDQxNDY5NjkzYWVlIiwidCI6IjM3ZDc1MjFhLTUwNzktNDhhZi05MTMxLTRhYzJjYjZmMWUzYSIsImMiOjF9">link</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Jeo-b9ROa9hEYdwMSDdzqQ.png" /><figcaption><strong>Image 7</strong>: Wide World Importer Data visualization Analysis</figcaption></figure><p><strong>Data Insights amongst many more:<br>1. </strong>Beverages is the most product imported into various countries</p><p>2. USA has the highest order sales followed by Germany</p><p>3. Most of the customers chose United Package as their shipping company and on average takes 8 days to ship product to each customers.</p><p><em>Interact more with the report to gain more insights — </em><a href="https://app.powerbi.com/view?r=eyJrIjoiM2NlNDc5MTQtMzlhNS00NjEzLWEwMDAtMDQxNDY5NjkzYWVlIiwidCI6IjM3ZDc1MjFhLTUwNzktNDhhZi05MTMxLTRhYzJjYjZmMWUzYSIsImMiOjF9"><em>link</em></a></p><p><strong>Appendix</strong><br>Always remember to schedule your dataflow refresh. This can be daily, weekly or depending on the time you would want it to refresh for daily report update.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IPthCTgTtBnjcyIMJMjZoA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8NDKW1_G3BaFD5CkjxAInQ.png" /></figure><p><em>Thank you for reading and please don’t forget to subscribe for latest publication.</em></p><p><em>Don’t stop being great!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=32f49ef60d65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Multiple Filter Query in Excel and Email Join function in Power Automate]]></title>
            <link>https://medium.com/@adeboladesoyin/multiple-filter-query-in-excel-and-email-join-function-in-power-automate-b93dede190c7?source=rss-925986e9fe77------2</link>
            <guid isPermaLink="false">https://medium.com/p/b93dede190c7</guid>
            <category><![CDATA[excel]]></category>
            <category><![CDATA[join-function]]></category>
            <category><![CDATA[power-automate-flow]]></category>
            <category><![CDATA[multiple-filter-query]]></category>
            <dc:creator><![CDATA[Adeboladesoyin]]></dc:creator>
            <pubDate>Fri, 16 Feb 2024 08:01:45 GMT</pubDate>
            <atom:updated>2024-02-16T12:42:04.583Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Way to handle multiple filtering in Excel Power Automate connection</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iL28rSaDaTkClQXBgr_uSA.png" /></figure><p>Ever wondered how to go about multiple filters in Excel connection action?<br>Ever wondered how you can join two email addresses together before triggering “send an email” in Power Automate?</p><p>Let me walk you through how to go about it in simple ways you can understand.</p><p>Case Study: We have an Excel sheet table named “Table4”. Our task is to send a combined Overdue reminder mail to Faith, Rume, and Sales every day after the submission date has passed. i.e. Faith, Rume, and Sales will receive the same email since they all fall on the same submission date category.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j9-UG4xLcaKZ90i_TWHFMA.png" /></figure><p><strong>Steps to achieving this</strong></p><ol><li><strong>Create a recurrence flow:</strong> Open Microsoft Power automate, click on new, and create a scheduled recurrence flow.</li><li>Click on the new action and open the “List rows present in the table”. Select the location and library of your table. This step helps you to retrieve your data from the table.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/734/1*7vuVwTHCGgRmO5x0xtp1FQ.png" /></figure><p>3. The next 3 steps help you retrieve only the dataset needed to meet the specific requirement of your email body. The filter array action gets the list of rows from the previous step, while multiple filters can be passed into the array to return the desired result. In this blog, 3 filters were passed into the array. <br>The code below retrieves rows where today is greater than the submission date and where status is equal to “Not Submitted” and Company’s name is “COMPANYA”.</p><p><strong>4</strong>. <strong>Merging of email addresses</strong><br>The select action maps the email address to the result of the filter. This extracts only the email addresses seen from the filter result.</p><p>Map: item()?[‘yourdatefield’]<br>Using compose action, a join function which is synonyms to merge in power query is used to merge each mapped address together. Note that a delimiter is compulsory to add in the join function, this enables the addresses to be separated by “;” to avoid error when triggering “send an email” action.</p><pre>@and(greater(formatdatetime(utcNow(), &#39;MM/dd/yyyy&#39;), formatdatetime(item()?[&#39;SUBMISSIONDATE&#39;], &#39;MM/dd/yyyy&#39;)), equals(item()?[&#39;STATUS&#39;], &#39;Not Submitted&#39;), equals(item()?[&#39;COMPANY&#39;], &#39;COMPANYA&#39;))</pre><pre>join(body(&#39;Select_4&#39;),&#39;;&#39;)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*wOhqd9PCTipeDCsuWHeCsw.png" /></figure><p>5. Next<strong> </strong>is creating a table that hosts the information you would want your receiver to see. In the select action, select the body of the filter query in step 3. Map all necessary fields to the result of the filter. Note that you will not be able to pick each field. <br>Hence, in your expression tab should look like this:<br>remember to replace the QUARTER with your field name for all headers.</p><pre>item()?[&#39;QUARTER&#39;]</pre><pre>div(sub(ticks(formatDateTime(utcNow(), &#39;yyyy-MM-dd&#39;)), ticks(formatDateTime(item()?[&#39;SUBMISSIONDATE&#39;], &#39;yyyy-MM-dd&#39;))), 864000000000)</pre><p>The Overdue Days field counts the number of days the tasks are overdue which subtracts today from the submission date. <br>“<strong>Create Html table</strong> action” converts the mapped fields into a structured table. It is the result of the Select 9 action.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*W-w9Pp3dmu2Gm51GmJg6fQ.png" /></figure><p>You can decide to add formatting to your table, such as color, width, borderline, etc. To do this, create a compose action and add/edit this HTML code in the input.</p><pre>&lt;style&gt;<br>table {<br>  border: 1px solid #1C6EA4;<br>  background-color: #EEEEEE;<br>  width: 100%;<br>  text-align: left;<br>  border-collapse: collapse;<br>}<br>table td, table th {<br>  border: 1px solid #AAAAAA;<br>  padding: 3px 2px;<br>}<br>table tbody td {<br>  font-size: 13px;<br>}<br>table thead {<br>  background: #52222D;<br>  border-bottom: 2px solid #444444;<br>}<br>table thead th {<br>  font-size: 15px;<br>  font-weight: bold;<br>  color: #FFFFFF;<br>  border-left: 2px solid #D0E4F5;<br>}<br>table thead th:first-child {<br>  border-left: none;<br>}<br>&lt;/style&gt;</pre><p>Finally, to avoid multiple emails sent out to one recipient, a condition action can be used. In this scenario, if the result of the filter query is empty or zero, do not send a mail, else, send a mail to the merged recipients.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*srAfXtUfLxRB2fmq7M3_Cw.png" /></figure><p>To: the outputs of compose 4 - This is the merged email address from compose 4. <br>The table outputs are the result of the compose action of style and from HTML table.</p><p>Your email output should look like this-</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idfE4DxEtgsirZ84Dsl3jA.png" /></figure><p>If you noticed, all recipients who have their submission date on the same day received the same mail. Hence, the a need for the join function.</p><p><strong>In conclusion</strong></p><p>We have learned how multiple filters can be used for Excel data sources without converting to SharePoint List. Likewise, learned how to send a unified mail to email recipients in the same deadline category.</p><p>In case of any questions related to this project, please feel free to post your comments below.</p><p>Thank you and stay tuned!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b93dede190c7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>