<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: shiningamour</title>
    <description>The latest articles on DEV Community by shiningamour (@shiningamour).</description>
    <link>https://dev.to/shiningamour</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1059028%2F38e6863f-f7ca-4352-bd21-a3fcae7ca6c1.jpg</url>
      <title>DEV Community: shiningamour</title>
      <link>https://dev.to/shiningamour</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shiningamour"/>
    <language>en</language>
    <item>
      <title>Data Cleaning with Python: A Step-by-Step Guide Using a Kaggle Titanic Dataset</title>
      <dc:creator>shiningamour</dc:creator>
      <pubDate>Sun, 30 Apr 2023 11:52:49 +0000</pubDate>
      <link>https://dev.to/shiningamour/data-cleaning-with-python-a-step-by-step-guide-using-a-kaggle-titanic-dataset-1b42</link>
      <guid>https://dev.to/shiningamour/data-cleaning-with-python-a-step-by-step-guide-using-a-kaggle-titanic-dataset-1b42</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;An essential step in any data analytic project is the data cleaning phase. This process entails identifying and fixing problems with missing data, inaccuracies, and inconsistencies in the chosen dataset to make sure the data is complete, accurate, and reliable. This article will showcase the various steps involved in data cleaning. We will be using the Titanic dataset from Kaggle and respective examples using Python code snippets. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Dataset Description&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This article uses the "Titanic: Machine Learning from Disaster" dataset on Kaggle. A dataset of passenger records from the Titanic. The dataset includes sex, age, class, fare, and survival status. You can download the dataset from the link below:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.kaggle.com/c/titanic/data"&gt;https://www.kaggle.com/c/titanic/data&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Importing Libraries and Loading Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To begin, you have to import all the required Python libraries and load the dataset. For reading the dataset into the pandas dataframe we will use the pandas library. Below is a Python code snippet for the above step:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Importing libraries

import pandas as pd


# Loading dataset

df = pd.read_csv('train.csv')

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code snippet, we imported the pandas library using the "import pandas as pd" syntax. This statement would allow the use of the pandas library as "pd" alias. Next, we load the dataset by utilizing the "pd.read_csv('train.csv')" function. The function stores the CSV file as pandas dataframe after reading it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Exploring Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After uploading the data, it is worthwhile to explore the dataset to better understand it. This process checks for missing data, data types, and summarization. Below is a Python code snippet for the above steps:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Checking for missing values

print(df.isnull().sum())

# Checking data types

print(df.dtypes)

# Summarizing data

print(df.describe())

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The above code snippet checks for missing data using the "df.isnull().sum()" function. This function returns the total number of missing values contained in each column of the Titanic dataset. After this we used the "df.dtypes" function to determine the data types of Lastly the "df.describe()" function was called to summarize the data. This function retrieves different statistical measures such as mean, standard deviation, maximum, minimum, and quartile. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Cleaning Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;After the data exploration process, we will discover issues that need to be fixed to properly clean the dataset. Correcting inconsistencies, eliminating duplicate values, filling in missing data, and converting data types are some of the measures to clean the data. Below is a Python code snippet for the data cleaning step.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Filling in missing values

df['Age'].fillna(df['Age'].median(), inplace=True)

df['Embarked'].fillna(df['Embarked'].mode()[0], inplace=True)


# Converting data types

df['Pclass'] = df['Pclass'].astype('category')


# Removing duplicates

df.drop_duplicates(inplace=True)


# Correcting inconsistencies

df.loc[df['Age'] &amp;lt; 0, 'Age'] = df['Age'].median()

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Here is an explanation of the code snippet above.   Firstly we applied the "fillna()" function to fill in missing values in the 'Age' and 'Embarked' columns. We used the median value to fill in the missing value for the 'Age' column and the mode value for the 'Embarked' column. Using the "astype()" function we converted the 'Pclass' column of the dataset to a categorical data type. Also, we utilized the "drop_duplicates()" function to remove duplicate values. Lastly, we replaced negative values with median values to correct age column inconsistencies. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 4: Validating Cleaned Data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When you are done cleaning the data it's necessary to confirm that the data cleaning process was successful. This can be done by checking for missing values and data types, and then summarizing the data again. Below is a Python code snippet for this process.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Checking for missing values

print(df.isnull().sum())


# Checking data types

print(df.dtypes)


# Summarizing data

print(df.describe())


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To check for data types and missing values, and summarize the data again to ensure the cleaning process was successful, the code snippet above was used.  &lt;/p&gt;

&lt;p&gt;Below is Python code that displays the first five rows of cleansed data:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Importing libraries

import pandas as pd


# Loading dataset

df = pd.read_csv('train.csv')


# Filling in missing values

df['Age'].fillna(df['Age'].median(), inplace=True)

df['Embarked'].fillna(df['Embarked'].mode()[0], inplace=True)


# Converting data types

df['Pclass'] = df['Pclass'].astype('category')


# Removing duplicates

df.drop_duplicates(inplace=True)


# Correcting inconsistencies

df.loc[df['Age'] &amp;lt; 0, 'Age'] = df['Age'].median()


# Checking the cleansed data

print(df.head())

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Output:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  PassengerId Survived Pclass  \

0            1        0      3   

1            2        1      1   

2            3        1      3   

3            4        1      1   

4            5        0      3   


                                                Name     Sex   Age  SibSp  \

0                            Braund, Mr. Owen Harris    male  22.0      1   

1  Cumings, Mrs. John Bradley (Florence Briggs Th...  female  38.0      1   

2                             Heikkinen, Miss. Laina  female  26.0      0   

3       Futrelle, Mrs. Jacques Heath (Lily May Peel)  female  35.0      1   

4                           Allen, Mr. William Henry    male  35.0      0   


   Parch            Ticket     Fare Embarked  

0      0         A/5 21171   7.2500        S  

1      0          PC 17599  71.2833        C  

2      0  STON/O2. 3101282   7.9250        S  

3      0            113803  53.1000        S  

4      0            373450   8.0500        S 

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;As shown above, the columns for 'Age' and 'Embarked' with missing values have been filled in. The column 'Pclass' has also been converted to a categorical data type. It shows the removal of duplicate values and the correction of negative values in the 'Age' column. The data is clean and ready for additional analysis. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In conclusion, we took you through the entire data cleaning process using Python and the "Titanic" dataset from Kaggle. First, we imported the required libraries and loaded the Titanic dataset into Python. Then we conducted data exploration to better understand the dataset and identify diverse problems such as missing and duplicate values. These problems needed to be fixed to clean the dataset. To clean the data, we filled in missing values, converted data types, removed duplicates, and corrected inconsistencies in the data. The final step was to validate the cleaning process to ensure it was successful. To achieve this we checked for data types, missing values, and summarized the data again.  &lt;/p&gt;

&lt;p&gt;In any data analytics project, data cleaning is a crucial step that guarantees data reliability, accuracy and completeness. By following the guidelines in this article you will be able to clean your data effectively and make it fit for further analysis.  &lt;/p&gt;

</description>
      <category>datacleaning</category>
      <category>dataanalytics</category>
      <category>python</category>
      <category>pandas</category>
    </item>
    <item>
      <title>Getting Started with Feature Flags: A Comprehensive Guide</title>
      <dc:creator>shiningamour</dc:creator>
      <pubDate>Sat, 22 Apr 2023 19:35:28 +0000</pubDate>
      <link>https://dev.to/shiningamour/getting-started-with-feature-flags-a-comprehensive-guide-49a2</link>
      <guid>https://dev.to/shiningamour/getting-started-with-feature-flags-a-comprehensive-guide-49a2</guid>
      <description>&lt;p&gt;Interested in feature flags for improving software development processes, but don't know how to do it? Here is a comprehensive step-by-step guide that walks you through the fundamentals of feature flags, benefits to software development processes, and finally tips to get you started. &lt;/p&gt;

&lt;p&gt;What are Feature Flags?&lt;/p&gt;

&lt;p&gt;Feature flags sometimes referred to as feature switches or toggles are software development approaches that allow software developers to switch features on and off during runtime without deploying new code. This technique allows for faster, less complex development and deployment processes. It also promotes the gradual rollout of new software features to specific users or groups. &lt;/p&gt;

&lt;p&gt;The Benefits of Feature Flags&lt;/p&gt;

&lt;p&gt;There are several advantages to feature flags in software development, which include:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Faster release cycles:&lt;/strong&gt; By using feature flags you can release new features to a subset of users, test them, and then systematically release them to all users. This implies that you can roll out new features faster without bugs and compatibility issues. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Reduce risk:&lt;/strong&gt; The gradual release of new features to a subset of users reduces the risk of new bugs and compatibility issues that might affect all users. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Better Testing:&lt;/strong&gt; With feature flags, you can test new features in a production-like environment before releasing them to all users. This means bugs can be caught and debugged before they affect all users.&lt;/p&gt;

&lt;p&gt;Improved user experience: by using Feature flags you can tailor the user experience to various batches of users. Doing so can increase retention and engagement rates. &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Getting Started with Feature Flags&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
Now that you understand the benefits of feature flags, let's walk you through how to use feature flags in software development processes.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 1: Identify the features you want to flag&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Identifying the features to flag is the first step to feature flagging. This could comprise existing features that need modification or removal or entirely new features you want to add to your application. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 2: Choose a feature flagging tool&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Next, you have to select a feature flagging tool to use. Note that there are various feature flagging tools to pick from, including LaunchDarkly, Split, and ConfigCat. When choosing a feature flagging tool, it's imperative to evaluate factors such as integration and ease of use. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Step 3: Implement feature flags in your code&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once you have made your choice of a feature flagging tool, it's now time to start implementing feature flags inside your code. To do this, you need to add conditional statements to your code that check if a feature flag is enabled or disabled. The feature code will be executed if the feature flag is enabled. The feature code will be skipped if the feature flag in your code is disabled.&lt;/p&gt;

&lt;p&gt;Below is a Python code snippet that demonstrates how to implement a feature flag using the ConfigCat feature flagging tool:&lt;/p&gt;

&lt;p&gt;import configcatclient&lt;/p&gt;

&lt;p&gt;configcatclient.initialize("")&lt;/p&gt;

&lt;p&gt;is_new_feature_enabled = configcatclient.get_value("", False)&lt;/p&gt;

&lt;p&gt;if is_new_feature_enabled:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Code for the new feature goes here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;else:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Code for the old feature goes here
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;

&lt;p&gt;*&lt;em&gt;Step 4: Create feature flag configurations&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
You are expected to create feature flag configurations in the feature flagging tool after implementing feature flags in your code. This process pertains to defining various feature flag statuses (i.e. on, off, or gradual rollout) and establishing which users or batches of users should have access to the features in each state. &lt;/p&gt;

&lt;p&gt;For instance, defining a feature flag configuration that would gradually roll out this feature to 15% of users for testing. It would then roll it out to the remaining 85% of users after the testing is completed by the 15%. &lt;/p&gt;

&lt;p&gt;*&lt;em&gt;Step 5: Test your feature flags&lt;br&gt;
*&lt;/em&gt;&lt;br&gt;
It is essential to conduct in-depth testing of your feature flags before rolling them out to all users. This step entails the creation of a test group or groups in your feature flagging tool. It also involves gradually rolling out the new features to the test groups. &lt;/p&gt;

&lt;p&gt;For example, let's assume you are developing a new feature for a fintech website. You might create a test group of 15% of your total users and commence a gradual rollout of the new feature to the specified group over a couple of days. During this period, you can monitor feedback and behavioral patterns from users to discern any problems with the new feature, delay in loading, or poor user-friendliness. &lt;/p&gt;

&lt;p&gt;If any issue is found, the feature flag can be disabled and the necessary changes made before a final rollout is carried out for the remaining users. This process helps to lower the risk of bugs and compatibility problems that might affect all users and guarantees a smooth user experience. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Feature flags are an effective tool that improves software development processes. It creates a medium for faster release of new features, lower risk, and improved user experience. By following the guidelines outlined above, you can start using feature flags and enjoy their benefits for your software development team and users respectively. &lt;/p&gt;

&lt;p&gt;Recall, the way to successful feature flagging implementation is to start small and slowly roll out the new features to different batches of users. This method allows you to catch and debug any bugs before they affect all users, guaranteeing a user-friendly and smooth user experience.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;“Feature flags: What are they and why should you use them?” by Martin Fowler. &lt;a href="https://martinfowler.com/articles/feature-toggles.html"&gt;https://martinfowler.com/articles/feature-toggles.html&lt;/a&gt;&lt;br&gt;
“The Future of Continuous Delivery is Feature Flags” by Pete Hodgson. &lt;a href="https://martinfowler.com/articles/feature-toggles.html"&gt;https://martinfowler.com/articles/feature-toggles.html&lt;/a&gt;&lt;br&gt;
“Why You Should Use Feature Flags, and How To Do It With Java” by Ahmed Abdelrazek. &lt;a href="https://www.telerik.com/blogs/why-you-should-use-feature-flags-and-how-to-do-it-with-java"&gt;https://www.telerik.com/blogs/why-you-should-use-feature-flags-and-how-to-do-it-with-java&lt;/a&gt;&lt;br&gt;
“Using Feature Flags for CI/CD” by Raja Rao DV. &lt;a href="https://devops.com/using-feature-flags-for-ci-cd/"&gt;https://devops.com/using-feature-flags-for-ci-cd/&lt;/a&gt;&lt;br&gt;
“A/B Testing with Feature Flags” by D. Keith Casey Jr. &lt;a href="https://auth0.com/blog/a-b-testing-with-feature-flags/"&gt;https://auth0.com/blog/a-b-testing-with-feature-flags/&lt;/a&gt;&lt;br&gt;
“Feature Flags in Kubernetes” by Justin Domingus. &lt;a href="https://www.infoq.com/articles/feature-flags-kubernetes/"&gt;https://www.infoq.com/articles/feature-flags-kubernetes/&lt;/a&gt;&lt;br&gt;
“Feature Flagging Best Practices” by Danielle Adams. &lt;a href="https://rollout.io/blog/feature-flagging-best-practices/"&gt;https://rollout.io/blog/feature-flagging-best-practices/&lt;/a&gt;&lt;br&gt;
“The Benefits of Feature Flags and How to Implement Them in React” by Tanveer Naseer. &lt;a href="https://dzone.com/articles/the-benefits-of-feature-flags-and-how-to-implement"&gt;https://dzone.com/articles/the-benefits-of-feature-flags-and-how-to-implement&lt;/a&gt;&lt;br&gt;
“The Ultimate Guide to Feature Flagging” by Martin Gutenbrunner. &lt;a href="https://launchdarkly.com/blog/the-ultimate-guide-to-feature-flagging/"&gt;https://launchdarkly.com/blog/the-ultimate-guide-to-feature-flagging/&lt;/a&gt;&lt;br&gt;
ConfigCat documentation. &lt;a href="https://configcat.com/docs/"&gt;https://configcat.com/docs/&lt;/a&gt;&lt;/p&gt;

</description>
      <category>featureflags</category>
      <category>programming</category>
      <category>webdev</category>
      <category>python</category>
    </item>
  </channel>
</rss>
