<?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 Saba Firdous on Medium]]></title>
        <description><![CDATA[Stories by Saba Firdous on Medium]]></description>
        <link>https://medium.com/@saba.firdous7788?source=rss-2d4905701b40------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*J54QyaO3tMSgFxAM</url>
            <title>Stories by Saba Firdous on Medium</title>
            <link>https://medium.com/@saba.firdous7788?source=rss-2d4905701b40------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 19:21:53 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@saba.firdous7788/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[Accident Trends in France: A Comprehensive Data Analysis Over 12 Years]]></title>
            <link>https://python.plainenglish.io/accident-trends-in-france-a-comprehensive-data-analysis-over-12-years-233b3db25122?source=rss-2d4905701b40------2</link>
            <guid isPermaLink="false">https://medium.com/p/233b3db25122</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science-projects]]></category>
            <dc:creator><![CDATA[Saba Firdous]]></dc:creator>
            <pubDate>Sun, 10 Sep 2023 18:51:06 GMT</pubDate>
            <atom:updated>2024-02-13T04:16:03.839Z</atom:updated>
            <content:encoded><![CDATA[<p>Road accidents pose a significant societal challenge worldwide, leading to loss of lives, injuries, and economic costs. France, with its extensive road network and diverse traffic conditions, is no exception to this issue.</p><p>Road accidents pose a significant societal challenge worldwide, leading to loss of lives, injuries, and economic costs. France, with its extensive road network and diverse traffic conditions, is no exception to this issue.</p><h3>Objective</h3><p>In recent years, the utilization of data science techniques to predict and prevent accidents has gained traction. By harnessing the potential of machine learning and statistical analysis, we aim to identify the key factors contributing to accidents, assess their impact, and build a reliable model for accident prediction.</p><h3>Necessary Libraries</h3><p><strong>Pandas:</strong> Importing the Pandas library for data manipulation and analysis. <strong>NumPy: </strong>Utilizing NumPy for numerical computations and array operations. <strong>Matplotlib: </strong>Creating data visualizations and plots using the Matplotlib library. <strong>Seaborn: </strong>Enhancing the aesthetics of statistical graphics with the Seaborn library.</p><h3>Methodology:</h3><h3>Data Source</h3><p>The foundation of this study is a comprehensive dataset sourced from <a href="https://www.kaggle.com/datasets/ahmedlahlou/accidents-in-france-from-2005-to-2016">Kaggle,</a> containing information about road accidents spanning several years. This dataset encompasses a wide array of variables, including geographical location, road conditions, weather, vehicle types, human factors, and accident severity. The richness of this dataset allows for a thorough analysis that can uncover hidden patterns and insights contributing to accidents.</p><p><strong>Acquiring Data: </strong>The first process in a data science project is to acquire data. So the data we used here is in CSV format for both training and test data.</p><h4>Data Preprocessing / Data Cleaning</h4><p>There were five sets of data related to vehicles, characteristics, users, places, and holidays during the accidents. The initial step involves cleaning and transforming the raw data into a usable format.</p><h4>Handling Missing Data:</h4><p>An analysis of missing data was conducted to understand the extent of missing values in each column. This includes handling missing values, encoding categorical variables, and standardizing data.</p><p>Example code: Handling missing Data:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-xqtffgKObwJDXPfjCz0Jg.png" /></figure><pre># Removing extra spaces from columns name<br>df.columns = df.columns.str.strip()</pre><pre>#Example of renaming column<br>df.rename(columns={<br>    &#39;SDevelopment-Infrastructure&#39;: &#39;Development-Infrastructure&#39;<br>}, inplace=True)</pre><pre># Changing &#39;date&#39; column to datetime type<br>df[&#39;date&#39;] = pd.to_datetime(df[&#39;date&#39;])</pre><h3>Exploratory Data Analysis (EDA)</h3><p>During the EDA phase, an in-depth examination of each column in the dataset was conducted to derive insights into their impact on the severity of accidents.</p><p>This involved investigating various factors, including whether safety equipment was utilized during accidents and the manner in which these safety measures were implemented. The primary objective was to discern patterns, trends, and potential correlations between these factors and the severity of accidents.</p><h3>Trend Analysis</h3><p>This includes parsing date and time information, visualizing temporal trends, and analyzing trends based on several categorical variables.</p><p>Created a Custom Function:</p><p>This custom function combines the date and time components from your dataset to create a single DateTime object representing the exact timestamp of each accident. This is useful for temporal analysis and plotting trends over time, such as the temporal trends you’ve visualized in your code.</p><pre># Create a custom function to parse the date and time<br>def parse_date_and_time(row):<br>    year = int(row[&#39;year_of_acc&#39;])<br>    month = int(row[&#39;month_of_acc&#39;])<br>    day = int(row[&#39;day_of_acc&#39;])<br>    hour = row[&#39;acc_tim_in_hour_min&#39;] // 100<br>    minute = row[&#39;acc_tim_in_hour_min&#39;] % 100<br>    return pd.Timestamp(year, month, day, hour, minute)<br><br># Apply the custom function to create a &#39;date&#39; column<br>df[&#39;date&#39;] = df.apply(parse_date_and_time, axis=1)</pre><h4>Temporal Analysis:</h4><ul><li>Extracts relevant columns for temporal analysis.</li><li>Parses date and time information from separate columns into a single ‘date’ column.</li><li>Plots temporal trends for accidents:</li><li>Accidents by year</li><li>Accidents by month</li><li>Accidents by day of the week</li><li>Accidents by hour of the day</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vk-vjx9EmmV_XuaxoQAapQ.png" /></figure><h4>Severity Analysis by Lighting Conditions:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original lighting condition values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on lighting conditions and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wYne6au7RUkGQKng_evWTg.png" /></figure><h4>Severity Analysis by Atmospheric Conditions:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original atmospheric condition values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on atmospheric conditions and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VSTYbG6wCZawh73pX7tXkA.png" /></figure><h4>Severity Analysis by Collision Type:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original collision-type values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on collision types and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QQioNcUErDzh183uwKBJjA.png" /></figure><h4>Severity Analysis by Road Category:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original road category values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on road categories and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fAYkPbcj1WGrtGEgJcNaBQ.png" /></figure><h4>Severity Analysis by Traffic Regime:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original traffic regime values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on traffic regimes and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ed1VS0xvw75YnRmeDYBVfw.png" /></figure><h4>Severity Analysis by Reserved Lane Type:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original reserved lane values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on reserved lane types and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oo__2ejkrtUi1fRWV5vcGg.png" /></figure><h4>Severity Analysis by Longitudinal Profile:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original longitudinal profile values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on longitudinal profiles and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ezDaAc_d5WD6sO5KnBuTVQ.png" /></figure><h4>Severity Analysis by Surface Condition:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original surface condition values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on surface conditions and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*20FgP_fAsWtfboXGACVI9Q.png" /></figure><h4>Severity Analysis by Development Infrastructure:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original development infrastructure values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on development infrastructure and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uz24WVkRqA6pCXzkSdM2WQ.png" /></figure><h4>Severity Analysis by Accident Situation:</h4><ul><li>Defines severity categories and their descriptions.</li><li>Creates a mapping for original accident situation values to descriptions.</li><li>Analyzes the number of accidents for each severity category based on accident situations and plot bar charts.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T8eHnc7kt8oqYsIgg1m7eg.png" /></figure><p>Each section of this code performs a detailed analysis of accident data based on various attributes and provides visualizations to help understand the trends and relationships within the data. This kind of EDA is crucial for gaining insights and informing further steps in a data science project, such as modeling and prediction.</p><h4>Safety Equipment Usage:</h4><p>The EDA explored whether safety equipment was employed during accidents or not. This encompassed evaluating instances where safety measures such as seatbelts, helmets, airbags, and other protective gear were utilized by individuals involved in accidents.</p><p>An important angle of the analysis involved determining how the positioning of safety equipment impacted accident severity. This entailed examining whether the positions of individuals in relation to safety features had any bearing on the outcome of the accident. For example, whether the correct usage of a seatbelt reduced the severity of injuries sustained<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*cgPlNnRtc16bZlQOaeBQLw.png" /></figure><p><strong>W</strong>e meticulously examined the impact of atmospheric conditions on the severity of accidents. This involved closely analyzing the various weather conditions present during accidents, including factors such as rain, wind, fog, and normal weather.</p><p>By conducting this comprehensive examination of atmospheric conditions and their correlation with accident severity, we gained valuable insights into how weather factors impact the outcomes of accidents.</p><h4>Time Analysis</h4><p><strong>Accidents by Time Interval</strong></p><p>Time data was grouped into intervals (e.g., 00–03, 03–06) to analyze accident patterns throughout the day. The chart below shows the distribution of accidents and survivors by time interval. This analysis aimed to discern patterns and trends regarding the occurrence of accidents within specific time periods.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/567/1*wgmFvcWuzXHamVgGJWm13g.png" /></figure><h3><strong>Accident Severity Analysis</strong></h3><p><strong>Accidents by Severity and Day: </strong>This analysis explores how accidents are distributed by severity across different days of the week.</p><p><strong>Accidents by Severity and Year: </strong>The distribution of accidents by severity across different years is visualized.</p><p><strong>Accidents by Severity and Month: </strong>This analysis examines the distribution of accidents by severity throughout the months of the year.</p><h4><strong>Conclusion</strong></h4><ul><li>Accidents occur consistently throughout the day, with slightly more occurring during the morning hours.</li><li>The dataset contains varying levels of missing data across different columns.</li><li>Atmospheric conditions like “fine with high winds” and “fine with mist” are associated with the highest number of accidents.</li><li>Severity 2 accidents are the most common, and their distribution remains relatively stable across days, years, and months.</li></ul><h4>Further Readings</h4><p>In this data science project, I conducted Exploratory Data Analysis (EDA), while my colleague, Hira Sadiq, focused on model fitting to explore the relationship between the variables discussed in the article <a href="https://medium.com/@sadiqq.hira/471bc6db5bc9">here</a>, and Fareeha Saleem created a POWER BI dashboard in the article <a href="https://medium.com/@fareehasaleem2002/so-far-data-cleaning-and-for-null-hypothesis-have-been-discussed-in-blogs-by-saba-firdous-and-hira-7b53522a413">here</a>. Fareeha’s dashboard included insightful graphs that highlighted the relationships between various features.</p><h3>In Plain English 🚀</h3><p><em>Thank you for being a part of the </em><a href="https://plainenglish.io/"><strong><em>In Plain English</em></strong></a><em> community! Before you go:</em></p><ul><li>Be sure to <strong>clap</strong> and <strong>follow</strong> the writer ️👏<strong>️️</strong></li><li>Follow us: <a href="https://twitter.com/inPlainEngHQ"><strong>X</strong></a><strong> | </strong><a href="https://www.linkedin.com/company/inplainenglish/"><strong>LinkedIn</strong></a><strong> | </strong><a href="https://www.youtube.com/channel/UCtipWUghju290NWcn8jhyAw"><strong>YouTube</strong></a><strong> | </strong><a href="https://discord.gg/in-plain-english-709094664682340443"><strong>Discord</strong></a><strong> | </strong><a href="https://newsletter.plainenglish.io/"><strong>Newsletter</strong></a></li><li>Visit our other platforms: <a href="https://stackademic.com/"><strong>Stackademic</strong></a><strong> | </strong><a href="https://cofeed.app/"><strong>CoFeed</strong></a><strong> | </strong><a href="https://venturemagazine.net/"><strong>Venture</strong></a></li><li>More content at <a href="https://plainenglish.io/"><strong>PlainEnglish.io</strong></a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=233b3db25122" width="1" height="1" alt=""><hr><p><a href="https://python.plainenglish.io/accident-trends-in-france-a-comprehensive-data-analysis-over-12-years-233b3db25122">Accident Trends in France: A Comprehensive Data Analysis Over 12 Years</a> was originally published in <a href="https://python.plainenglish.io/">Python in Plain English</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>