<?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 Sameeramd on Medium]]></title>
        <description><![CDATA[Stories by Sameeramd on Medium]]></description>
        <link>https://medium.com/@sameeramd137?source=rss-bfb3c9b75781------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*neGyGOLhrRIu8Nxm</url>
            <title>Stories by Sameeramd on Medium</title>
            <link>https://medium.com/@sameeramd137?source=rss-bfb3c9b75781------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:45:50 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sameeramd137/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[Unveiling the Art of missing values:]]></title>
            <link>https://medium.com/@sameeramd137/unveiling-the-art-of-missing-values-b150eb472da8?source=rss-bfb3c9b75781------2</link>
            <guid isPermaLink="false">https://medium.com/p/b150eb472da8</guid>
            <dc:creator><![CDATA[Sameeramd]]></dc:creator>
            <pubDate>Thu, 25 Jan 2024 10:11:57 GMT</pubDate>
            <atom:updated>2024-01-25T10:11:57.141Z</atom:updated>
            <content:encoded><![CDATA[<h3>A Radiant Approach to Filling Missing Values in Your Data Frame.</h3><p><strong>Unlocking the secrets of missing data is crucial in real-life scenarios, as it often plagues datasets with challenges. Termed as NA (Not Available) values in pandas, missing data can stem from the absence of information for specific items or entire units.</strong></p><p>In the intricate world of data analysis, missing values play the role of elusive puzzle pieces, each one holding a crucial fragment of the complete picture. Picture a jigsaw puzzle where even a single missing piece leaves the entire masterpiece incomplete. In our data frame, these missing values act as the unsung heroes, or rather, the missing links, shaping the narrative of our analyses.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/670/1*3e8TEpjm52ZBU2ElkRv2lA.png" /></figure><p><strong>Sources of Missing Values:</strong></p><ol><li>User forgot to fill in a field.</li><li>Data was lost while transferring manually from a database.</li><li>There was a programming error.</li><li>users chose not to fill out a field to their beliefs about hoe thw results would be used or interpreted.</li></ol><p>Python’s pandas library, NaN and NaT represent missing or undefined values, but they are used in different contexts:</p><blockquote>NaN (Not a Number):</blockquote><ul><li>NaN is used to represent missing numerical values in a Data Frame or Series. It is a standard IEEE floating-point representation for undefined or unrepresentable values for numeric data types.</li></ul><figure><img alt="For example create an data frame called ‘data’ and we can see the missing of numerical and categorical data will be denoted by ‘NaN’ ." src="https://cdn-images-1.medium.com/max/517/1*YtFT-8rk6Q2DLuq2KOM65g.png" /><figcaption>Example showing how an NaN value is being shown in an data.</figcaption></figure><blockquote>NaT (Not a Time):</blockquote><ul><li>NaT is used to represent missing datetime values in pandas. It stands for &quot;Not a Time&quot; and is the equivalent of NaN for datetime data types.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/633/1*b8ZtRuOqtNfe9xmvxpYwpA.png" /></figure><h3>3 Types Of Missingness:</h3><p>Embarking on the journey of data analysis unveils a landscape where missing values cast shadows upon the clarity of insights. In this realm, the three enigmatic types of missingness — <br><strong>* MCAR-missing completely at random<br>* MAR-missing at random<br>* MNAR-missing not at random</strong></p><h4>1. MCAR (Missing Completely At Random):</h4><ul><li>“missing completely at random” (MCAR) describes a situation where the absence of data occurs randomly and independently of both observed variables and any unobservable parameters of interest. In MCAR, the missingness is not influenced by the values of other variables in the dataset. Analyzing data under the assumption of MCAR ensures unbiased results, but truly MCAR conditions are seldom encountered in real-world datasets. When data are MCAR, the randomness in missing values implies that participants with complete data form a random sample. However, achieving genuine MCAR conditions is often challenging in practice, making it essential for researchers to be mindful of the assumptions and limitations associated with this idealized scenario.</li></ul><h4><strong>Ex:Imagine you have a bag of colored candies. MCAR is like randomly losing some candies from the bag without any reason or pattern. It’s as if the candies just decided to disappear on their own, and there’s no connection between which candies went missing and anything else.</strong></h4><h4>2. MAR (Missing At Random):</h4><ul><li>“Missing at random” (MAR) suggests that the occurrence of missing data is not entirely random but can be predicted based on other variables present in the dataset. Although statistical verification is not possible, researchers rely on the assumption’s substantive reasonableness. For instance, if males are less likely to complete a depression survey, but this is unrelated to their actual level of depression when considering their gender, it fits the MAR concept. Despite potential biases in some analysis methods, approaches like Full Information Maximum Likelihood (FIML) can offer unbiased estimates under MAR, making it a crucial concept in managing missing data challenges during statistical analyses.</li></ul><h4><strong>Ex:Now, let’s say you have different colors of balloons. MAR is when the balloons pop randomly, but the chance of a balloon popping depends on the color. For example, red balloons might be more likely to pop, but it’s still random within each color group. So, it’s not like someone is intentionally picking certain balloons to pop; it’s just that, on average, some colors have a higher chance of popping.</strong></h4><h4>3. MNAR (Missing Not At Random):</h4><ul><li>“Missing not at random” (MNAR) signifies data that is neither randomly nor predictably missing; the absent values are linked to the variable being absent. In the example of a depression survey, if men skip the survey due to their depression level, it’s an instance of MNAR. This situation poses challenges, as the missingness is tied to the variable itself, demanding specialized approaches for analysis</li></ul><h4>Ex: Lastly, imagine you have a group of friends playing a game, and some friends are more likely to hide than others. MNAR is like missing data where it’s not random, and it depends on something specific. In our game example, if the friends who are shy are more likely to hide and not be seen, the missing data is not random because it’s connected to their shyness.</h4><p>In simpler terms:</p><ul><li>MCAR: Disappearing without any specific reason, completely random.</li><li>MAR: Popping balloons randomly, but the chance depends on the color.</li><li>MNAR: Missing because of a specific reason, like being shy in a game.</li></ul><p>These concepts help scientists and researchers understand how and why data might be missing in their studies.</p><p><strong>Imputing missing values:</strong> Imputing missing values in a Data Frame is a common preprocessing step in data analysis and machine learning. The method you choose for imputation depends on the nature of your data and the reason behind the missing values. Here are some common techniques for handling missing values in a Data Frame using Python and the pandas library:</p><p><strong>1.Dropping Missing Values</strong>: If the missing values are relatively few and randomly distributed, you might choose to simply drop the rows or columns with missing values using the ‘dropna( )’ function:</p><pre>df.dropna(inplace=True)  # Drops rows with missing values</pre><p><strong>2.Fill with a Constant Value: </strong>You can fill missing values with a constant value using the fillna() function:</p><pre>df.fillna(value, inplace=True)  # Replace NaN with a specific value</pre><p>3.<strong>Fill with Mean, Median, or Mode:</strong> For numerical data, you can fill missing values with the mean, median, or mode of the respective columns using fillna():</p><pre>df.fillna(df.mean(), inplace=True)  # Replace NaN with mean values</pre><p>4.<strong>Forward Fill (ffill) or Backward Fill (bfill):</strong> You can fill missing values by propagating the last known value forward (ffill) or using the next available value backward (bfill):</p><pre>df.ffill(inplace=True)  # Forward fill<br># or<br>df.bfill(inplace=True)  # Backward fill</pre><p>5.<strong>Interpolation:</strong> Interpolation is a method that estimates missing values based on the values of neighboring data points. Pandas provides the interpolate() function for this purpose:</p><pre>df.interpolate(method=&#39;linear&#39;, inplace=True)</pre><p>please go trough the link for your reference:</p><p><a href="https://pandas.pydata.org/docs/reference/frame.html#missing-data-handling">DataFrame - pandas 2.2.0 documentation</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b150eb472da8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Decorators in Python]]></title>
            <link>https://medium.com/@sameeramd137/decorators-in-python-ad24b56a8807?source=rss-bfb3c9b75781------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad24b56a8807</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[decorators]]></category>
            <dc:creator><![CDATA[Sameeramd]]></dc:creator>
            <pubDate>Thu, 23 Nov 2023 04:04:46 GMT</pubDate>
            <atom:updated>2023-11-23T04:04:46.644Z</atom:updated>
            <content:encoded><![CDATA[<blockquote>Decorators are Adding extra functionality to a existing function.</blockquote><h3>Decorator</h3><ul><li>Decorators are simply functions.</li><li>Like any function, decorators perform a task. The difference here is that decorators apply logic or change the behavior of other functions.</li><li>They are an excellent way to reuse code, and can help to separate logic into individual concerns.</li><li>the decorators are used to modify the behaviour of function or class. In Decorators, functions are taken as the argument into another function and then called inside the wrapper function.</li><li>the ‘@’ symbol followed by the decorator name above the function or class definition.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/598/0*ns45TgA9ijJa3crb.png" /></figure><ul><li>When you use a decorator, you’re essentially wrapping a function or class with another function, which allows you to modify its behavior. Decorators are used for tasks like logging, timing, authentication, or adding additional functionality to existing code. Here’s an example to help illustrate how decorators work:</li></ul><pre>def decorator_function(original_function):<br>    def wrapper_function(*args, **kwargs):<br>        # Additional code before the original function is called<br>        print(&quot;Decorator: Before the function is called&quot;)<br>        result = original_function(*args, **kwargs)<br>        # Additional code after the original function is called<br>        print(&quot;Decorator: After the function is called&quot;)<br>        return result<br>    return wrapper_function</pre><pre>@decorator_function<br>def greet(name):<br>    print(f&quot;Hello, {name}!&quot;)<br>greet(&quot;Sameera&quot;)<br></pre><p>In this example, the decorator_function is defined to wrap the greet function. It adds some extra code before and after the original function is called. When we call greet(&quot;Sameera&quot;), it will execute the wrapper function defined in the decorator, which in turn calls the original greet function. The output will be:</p><pre>Decorator: Before the function is called<br>Hello, Sameera!<br>Decorator: After the function is called</pre><p>This demonstrates how the decorator modifies the behavior of the original function by adding extra functionality. You can also use class-based decorators, which follow a similar concept but use classes instead of functions. They provide more flexibility and can maintain state between function calls.</p><h3>methods</h3><p><strong>instance methods</strong></p><ul><li>these methods take self as first parameter, we use these methods to modify or alter the instance’s attributes or state.</li><li>These are so called because they can access unique data of their instance.</li><li>If you have two objects each created from a car class, then they each may have different properties. They may have different colors, engine sizes, seats, and so on.</li><li>Inside any instance method, you can use self to access any data or methods that may reside in your class. You won’t be able to access them without going through self.</li><li>Through the self parameter, instance methods can freely access attributes and other methods on the same object.</li><li>Through the self parameter, instance methods can freely access attributes and other methods on the same object.</li></ul><p><strong>class methods</strong> @classmethod</p><ul><li>these methods accpets “cls” as their first attribute, we define a class method by using a decorator @classmethod.</li><li>Class methods know about their class. They can’t access specific instance data, but they can call other static methods.</li><li>class methods, on the other hand are useful for operations that need to be performed on the class as a whole, such as creating a new instance of the class, or modifying the class’s behavior in some way.</li><li>Instead of accepting a self parameter, class methods take a cls parameter that points to the class — and not the object instance — when the method is called.</li><li>Because the class method only has access to this cls argument, it can’t modify object instance state. That would require access to self.</li></ul><p><strong>static method</strong> @staticmethod</p><ul><li>we define static methods using @staticmethods decorator, these methods accepts no cls or self as first parameters.</li><li>Static methods are methods that are related to a class in some way, but don’t need to access any class-specific data. you can simply call your method.</li><li>You may use a static method to add two numbers together, or print a given string.</li></ul><p><strong>Summary</strong></p><ul><li>class method allows you to define methods that are shared by all instance of a class, and can be used to define factory methods, alternative constructors or methods that modify the class itself, while instance methods are defined for each instance of the class and allows you to define the behavior of an object.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad24b56a8807" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Numerical data types in PYTHON:]]></title>
            <link>https://medium.com/@sameeramd137/numerical-data-types-in-python-807fb3502120?source=rss-bfb3c9b75781------2</link>
            <guid isPermaLink="false">https://medium.com/p/807fb3502120</guid>
            <dc:creator><![CDATA[Sameeramd]]></dc:creator>
            <pubDate>Sat, 28 Oct 2023 15:53:34 GMT</pubDate>
            <atom:updated>2023-10-28T15:53:34.420Z</atom:updated>
            <content:encoded><![CDATA[<ul><li>Integer(123)</li><li>Float(15.59)</li><li>complex(3+3j)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nRvh4otNqhjHmgWXa75OPw.jpeg" /></figure><p><strong><em>INTEGER():</em></strong></p><p>In python integers are immutable, every value creating in python is an object of an predefined class,</p><p>for example: x=123</p><p>if we check for the ‘type(x)’ in the compiler then the output will be &lt;class ‘int’&gt;- here int is the class and number ‘123’ is the object which belongs to the class integer.</p><p>if we are converting the string into an integer using INT then the ‘int’ will be an function for example if we have to convert a string 10 into an integer 10 then- int (‘10’) here if we run this program in compiler then we will see the 10 is being changed to an integer.</p><p>As we have the integer class we have two classes called OCT () and HEX(), oct converts its integer value into octagonal form(Base 8) and hex converts its integer value into hexagonal form(Base 16)</p><p><strong><em>FLOAT()</em></strong>:</p><p>the value with an point ,the values which are after an point are called float values, in our language we call it as decimal. Float will mandatorily have a decimal value.</p><p>for example if we give ‘float(5)’ in an compiler so output will be ‘5.0&#39;</p><p><strong><em>COMPLEX():</em></strong></p><p>Complex is a data type in which we have real values as well as imaginary value an imaginary value can be √-1,normally in math&#39;s we represent it as‘i’ but in python we represent it as ‘j’</p><p>for example ‘x=5+3j’ -’print(x , type(x))’then we have run it in an compiler then the output will be ‘(5+3j) &lt;class ‘complex’&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=807fb3502120" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data types in Python]]></title>
            <link>https://medium.com/@sameeramd137/data-types-in-python-be3d0a670e5e?source=rss-bfb3c9b75781------2</link>
            <guid isPermaLink="false">https://medium.com/p/be3d0a670e5e</guid>
            <category><![CDATA[data-types-in-python]]></category>
            <category><![CDATA[example]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Sameeramd]]></dc:creator>
            <pubDate>Mon, 16 Oct 2023 15:51:07 GMT</pubDate>
            <atom:updated>2023-10-16T15:51:07.703Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://youtu.be/ftbZinXUBe0?si=hO2WGMiVmIriDMqm"><strong>Introduction of Python</strong></a>: <em>Python is a high-level object-oriented indentation programming language that is a readable, general-purpose, and versatile programming language that abstracts low-level complexities, operates as an interpreted language with cross-platform compatibility boasts an extensive standard library, fosters a strong community and ecosystem, supports object-oriented programming with dynamic typing, and serves as a go-to choice for both beginners and experienced programmers, making it applicable across a wide spectrum of applications.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_AeFeNIC5U-Ete6pwzd30A.png" /></figure><p><strong>Integer (int)</strong>: <em>This data type is used to represent whole numbers. In Python, for example, you can declare an integer variable like this: </em><strong><em>X=5</em></strong></p><ol><li><strong>Float (float)</strong>: <em>Floats are used to represent numbers with a decimal point. For instance: y=3.15</em></li><li><strong>String (str)</strong>: Strings are used to represent text. You can declare a string variable like this: name = &quot;John&quot;.</li><li><strong>Boolean (bool)</strong>: <em>Booleans have only two possible values, </em><em>True or </em><em>False, and are often used for conditional statements and comparisons. we can say as ‘1&#39; or ‘0&#39;.</em></li><li><strong>List</strong>: <em>A list is a collection of values, and it can hold various data types. In Python, a list is created using square brackets, like this</em>: my_list = [1, 2, 3, &quot;apple&quot;].</li><li><strong>Dictionary</strong>: <em>A dictionary is a collection of key-value pairs. Keys must be unique, and values can be of any data type. In Python, dictionaries are declared using curly braces, like this:</em> my_dict = {&quot;name&quot;: &quot;Alice&quot;, &quot;age&quot;: 30}.</li><li><strong>Tuple</strong>: <em>A tuple is similar to a list but is immutable, meaning its elements cannot be changed once it’s created. Tuples are often used for data that should not be modified. In Python, tuples are declared with parentheses</em>: my_tuple = (1, 2, 3).</li><li><strong>Set</strong>: <em>A set is an unordered collection of unique values. Sets are commonly used for tasks like removing duplicates from a list and they are mutable. In Python, sets are created with curly braces or the </em><em>set() constructor</em>: my_set = {1, 2, [11,12,13,14]}.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=be3d0a670e5e" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>