<?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 Pavan kumar reddy on Medium]]></title>
        <description><![CDATA[Stories by Pavan kumar reddy on Medium]]></description>
        <link>https://medium.com/@pavanreddy1828?source=rss-ae416c7594e3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*dmbNkD5D-u45r44go_cf0g.png</url>
            <title>Stories by Pavan kumar reddy on Medium</title>
            <link>https://medium.com/@pavanreddy1828?source=rss-ae416c7594e3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 16:53:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@pavanreddy1828/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[Exploring Sampling Techniques: Probability and Non-Probability]]></title>
            <link>https://medium.com/@pavanreddy1828/exploring-sampling-techniques-probability-and-non-probability-78d97c01f686?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/78d97c01f686</guid>
            <category><![CDATA[nonprobability]]></category>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[sampling-technique]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Tue, 19 Mar 2024 17:53:27 GMT</pubDate>
            <atom:updated>2024-03-19T17:53:27.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*_hx4dz476ZP3eHHniYwGZA.png" /></figure><p><strong>Population vs Sample:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/767/1*knqs6e28pPGqrqf6KDvp9w.png" /></figure><ul><li>Probability sampling means picking samples randomly from a group. Non-probability sampling is more about convenience or personal choice. How you choose your sample affects whether it truly represents the whole group and if there’s any bias. Probability sampling is the best bet for getting a sample that reflects the whole group.”<strong>Population</strong>: Imagine you want to study all the people in your country. That’s your population — the entire group you’re interested in.</li><li><strong>Sample</strong>: But it’s impossible to survey everyone, right? So you select a smaller group from the population. This smaller group is your sample — the individuals you’ll actually collect data from.</li></ul><p><strong>Why Do We Need Sampling?</strong></p><ul><li>Collecting data from everyone is like trying to eat an entire cake — it’s too much! Instead, we take a slice (our sample) to understand the whole cake (the population)</li></ul><p><strong>Types of Sampling:</strong></p><p><strong>Probability Sampling</strong>:</p><ul><li>Think of it as a fair lottery. Each person in the population has a chance to be in the sample.</li><li><strong>Advantage</strong>: Strong statistical conclusions about the whole group.</li><li><strong>Example</strong>: Randomly selecting voters to predict election results.</li></ul><p><strong>Non-Probability Sampling</strong>:</p><ul><li>Not like a lottery. We choose based on convenience or specific criteria.</li><li><strong>Advantage</strong>: Easy data collection.</li><li><strong>Example</strong>: Surveying people at a mall — convenient but not random.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/821/1*FWOVZT2E1Uj_B_kefsKanw.jpeg" /></figure><p><strong>Probability sampling:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*b_pv2b5CcUhFOzxx_1tC7w.png" /></figure><p>probability sampling means picking samples randomly from a group. Non-probability sampling is more about convenience or personal choice. How you choose your sample affects whether it truly represents the whole group and if there’s any bias. Probability sampling is the best bet for getting a sample that reflects the whole group.</p><h3><strong>Probability Sampling Methods</strong></h3><p>There are four different probability sampling methods:</p><ul><li>Simple random sampling</li><li>Stratified random sampling</li><li>Cluster random sampling</li><li>Systematic random sampling</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*BvVBdJ-Nb-2Zrv61MQifow.png" /></figure><ol><li><strong>Simple random sampling</strong></li></ol><p>In simple random sampling, each person in a group is picked randomly and has the same chance of being chosen. You can use tools like random number generators or other random methods to pick them.</p><p>For example, if you want to survey employees in a company of 10,000 people, you can give each person a number and use a random number generator to select 100 for your survey. This ensures fairness, avoiding bias and giving reliable results. However, it can be costly and time-consuming for large groups, and a bigger sample size gives better accuracy.</p><p><strong>2. Stratified random sampling:</strong></p><p>In stratified sampling, the population is divided into several distinct groups, and individuals are randomly chosen from each group.</p><p>For example, if you have data on the population from all 50 states in the USA and you want to take a sample, you might select 3 (or more) people from each state.</p><p><strong>3. Cluster Random Sampling</strong></p><p>The population is divided into clusters, which are separate groups of units. From these clusters, some are randomly chosen, and the sample consists of everyone within those selected clusters. For instance, out of the 50 states in the USA, you randomly select 3 states, and your sample includes everyone residing in those 3 states.</p><p><strong>4. Systematic random sampling</strong></p><p>Systematic sampling works with data that is arranged in a specific order. With this method, you choose a starting point and then select every k-th data point thereafter.</p><p>For example, if you have a list of contact information in a phone book, you might start with the 5th person and then select every 5th person after that as your sample data, such as the 5th, 10th, 15th, 20th, and so on.</p><p>Another example could be if you have a list of students in a classroom, you could start with the 3rd student and then select every 4th student after that as your sample, such as the 3rd, 7th, 11th, 15th, and so forth.</p><p>Advantages of Probability Sampling:</p><ol><li>Representativeness: It ensures that every member of the population has an equal chance of being chosen, making the sample more reflective of the entire population.</li><li>Reduced Bias: Random selection minimizes bias, leading to more objective and credible results.</li><li>Statistical Precision: It allows for the use of statistical techniques to make reliable predictions and draw meaningful conclusions.</li></ol><p>Disadvantages of Probability Sampling:</p><ol><li>Resource Intensive: It can be time-consuming and expensive to implement, especially for large populations.</li><li>Complexity: Some methods may require advanced statistical knowledge and expertise to execute effectively.</li><li>Feasibility Challenges: Obtaining a complete list of the population can be difficult or impractical in certain situations.</li><li>Potential for Errors: Despite efforts to minimize them, sampling errors can still occur, such as non-response or incomplete coverage of the population.</li></ol><h3>Non-probability sampling methods</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/634/1*tzlffjWPV3yybLfK8h96TA.png" /></figure><p>Non-probability sampling methods involve selecting participants using non-random techniques. As a result, not all individuals in a population have an equal chance of being included. While these methods carry a higher risk of sampling bias, they are often more cost-effective and convenient for researchers. In situations where time, budget, or other resources are limited, non-probability methods become necessary. Additionally, they can be valuable for exploratory studies, which aim to gain initial insights into a population rather than making broader inferences.</p><p>We’ll go over four methods of non-probability sampling:</p><ul><li>Convenience sampling</li><li>Voluntary response sampling</li><li>Snowball sampling</li><li>Purposive sampling</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/625/1*4Kt09VObZWePYYfiBQlm_Q.png" /></figure><p><strong>1.Convenience sampling</strong></p><p>Convenience sampling involves selecting population members who are easily accessible or reachable. This method entails collecting a sample from convenient locations, such as your workplace, a nearby school, or a local park.</p><p>Example: In a study about smartphone usage habits, you might conduct a convenience sample by surveying people at a shopping mall or a coffee shop where you can easily approach them.</p><p><strong>2. Voluntary response sampling</strong></p><p>A voluntary response sample consists of members of a population who volunteer to participate in a study. Like a convenience sample, a voluntary response sample is often based on convenient access to a population. However, instead of the researcher selecting participants, participants volunteer on their own.</p><p>For eample : A TV show asks viewers to call in and vote on their favorite contestant. The viewers who decide to call in and participate form a voluntary response sample.</p><p><strong>Snowball sampling:</strong></p><p>When the population is difficult to reach, snowball sampling involves recruiting participants through existing ones, with the number of participants growing as more people are contacted. However, there’s a drawback in representativeness because it’s uncertain how well the sample reflects the population since it relies on participants recruiting others. This can introduce bias into the sample.</p><p>For example : You start with one person, who refers you to others, and those others refer you to even more people, creating a chain reaction of participants, like a snowball rolling downhill.</p><p><strong>Purposive sampling</strong></p><p>In purposive sampling, researchers choose participants based on the specific objectives of their study. Participants are selected to align with the study’s goals, leading to the exclusion of applicants who do not meet the desired criteria.</p><p>For example : A researcher studying the effects of meditation on stress levels selects participants based on their meditation experience. Those who regularly practice meditation are chosen for the study, while others are excluded.</p><p>Advantages of Non-Probability Sampling:</p><ol><li>Convenience: Non-probability methods are quick and easy to implement, making them suitable for studies with limited resources.</li><li>Flexibility: Researchers can target specific groups, allowing for detailed exploration of particular subgroups.</li></ol><p>Disadvantages of Non-Probability Sampling:</p><ol><li>Bias: Non-probability methods can lead to biased results due to the lack of random selection.</li><li>Limited Generalizability: Findings may not be representative of the entire population, limiting their applicability.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=78d97c01f686" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics of probability]]></title>
            <link>https://medium.com/@pavanreddy1828/basics-of-probability-56020a666c81?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/56020a666c81</guid>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Tue, 12 Mar 2024 16:43:02 GMT</pubDate>
            <atom:updated>2024-03-13T06:36:33.642Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*COIyKY53ALnyvgxPnV1Evg.png" /></figure><p><strong>what is probability ?</strong></p><ul><li><strong>Probability</strong> is like a mathematical crystal ball that helps us predict how likely something is to happen.</li><li>Imagine you’re rolling a fair six-sided die. The probability of getting a specific number (say, a 3) is the chance it’ll show up when you roll the die.</li><li><strong>Here’s the formula:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*2s1-3bARMXIe_9udORybpg.png" /></figure><ul><li>Think of it as a ratio: How many ways the event you want can happen (favorable outcomes) divided by all the possible ways things could turn out (total outcomes).</li><li>The result is always between 0 (impossible) and 1 (certain). If it’s 0.5, it means it’s as likely as flipping a fair coin and getting heads.</li><li>So, probability helps us understand the odds and make informed decisions. 🎲</li></ul><h3><strong>probability space:</strong></h3><ol><li><strong>Sample Space:</strong></li></ol><ul><li>A sample space is a set of all possible outcomes or a collection of all the possible elements</li><li>Imagine you’re flipping a coin. The sample space is like having a little box that contains all the possible outcomes.</li><li>For a coin toss, the sample space is {H, T}, where <strong>H</strong> represents heads, and <strong>T</strong> represents tails.</li></ul><p><strong>2. Event:</strong></p><ul><li>An event is like picking something specific from that little box (sample space).</li><li>For our coin toss, the event “getting heads” is represented by {H}.</li></ul><h4>Let’s explore some different types of events:</h4><h4>a. Complementary Event:</h4><ul><li>Complementary events are two events that together cover all possible outcomes in a sample space.</li><li>For example, when rolling a fair six-sided die, the events “rolling an even number” and “rolling an odd number” are complementary because they cover all possible outcomes (1, 2, 3, 4, 5, 6).</li></ul><h4>b. Dependent Event:</h4><ul><li>Dependent events are events where the outcome of one event affects the probability of the other event.</li><li>For instance, drawing two cards from a deck without replacement is a dependent event because the probability of drawing the second card depends on what was drawn in the first draw.</li></ul><h4>c. Independent Event:</h4><ul><li>Independent events are events where the outcome of one event does not affect the probability of the other event.</li><li>Tossing a coin twice (assuming a fair coin) is an independent event because the outcome of the first toss does not impact the outcome of the second toss.</li></ul><h4>d. Mutually Exclusive Event:</h4><ul><li>Mutually exclusive events are events that cannot occur simultaneously.</li><li>For example, when flipping a coin, the events “getting heads” and “getting tails” are mutually exclusive because you cannot get both at the same time.</li></ul><h4>e. Exhaustive Event:</h4><ul><li>Exhaustive events are events that cover all possible outcomes in a sample space.</li><li>When rolling a standard six-sided die, the events “rolling a 1,” “rolling a 2,” “rolling a 3,” “rolling a 4,” “rolling a 5,” and “rolling a 6” are exhaustive because they include all possible results.</li></ul><h4><strong>3. Probability Measure:</strong></h4><ul><li>This is like assigning a chance value to an event.</li><li>The value ranges from 0 (impossible) to 1 (certain).</li><li>In our coin example, the probability of getting heads is 0.5 (or 1/2), because there are two equally likely outcomes (heads or tails).</li></ul><p>Remember, the sum of all probabilities in the sample space adds up to 1. So, if we consider both heads and tails, the total probability is 1 (0.5 + 0.5 = 1). 🎲👍</p><h3><strong>Random Variable:</strong></h3><ol><li>Discrete Random Variable:</li></ol><ul><li>Imagine rolling a fair six-sided die. The numbers you can get (1, 2, 3, 4, 5, 6) form a <strong>discrete random variable</strong>.</li><li>It’s like having a set of specific outcomes — each number on the die represents one of those outcomes.</li><li>For example, if you roll a six, the random variable value is 6.</li></ul><p>2. Continuous Random Variable:</p><ul><li>Now think about something that can take any value within a range, like the <strong>height of students</strong>.</li><li>Heights can vary infinitely — there’s no fixed set of specific values.</li><li>So, the height of students is an example of a <strong>continuous random variable</strong>.</li></ul><h3>Rules for probability:</h3><p>if A is an event, then P(A) is the probability of that event occurring. P(A)= Favorable Outcome/All outcomes.</p><p>The Probability of two individual events co-occurring is P(A)*P(B). This is the multiplication principle (<strong>and </strong>means <strong>multiply</strong>). It is also called the Intersection of two events P(A∩B).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/595/1*fWqVQ9BDXfZtk7WlDo523w.png" /></figure><p>The Probability of either of the two events occurring is P(A)+P(B). This is the additive principle (<strong>or </strong>means <strong>add</strong>). It is also called the Union of two events P(A∪B).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*NW9euljlFyALe1GGpTvrWg.png" /></figure><p><strong>→ Rule 1</strong>: The probability of any event A lies between 0 and 1 (inclusive): <strong>0 ≤ P(A) ≤ 1</strong>.</p><p><strong>→ Rule 2</strong>: The total sum of probabilities for all possible outcomes in a sample space is always equal to 1.</p><p><strong>→ Rule 3 (The Complement Rule)</strong>: The probability of the complement of event A (i.e., not A) is given by <strong>P(not A) = 1 — P(A)</strong>.</p><p><strong>→ Rule 4</strong>: Events that cannot happen simultaneously (i.e., they are mutually exclusive) are called disjoint events.</p><p><strong>→ Rule 5</strong>: The probability of either event A or event B occurring is calculated as <strong>P(A or B) = P(A) + P(B) — P(A and B)</strong>.</p><h3>Three Types of Probabilities</h3><ol><li><strong>Joint Probability</strong>:</li></ol><ul><li>The joint probability refers to the probability of <strong>two events occurring together</strong>. Mathematically, it is denoted as <strong>P(A ∩ B)</strong>, where <strong>A</strong> and <strong>B</strong> are the two events.</li><li>For example, if we have events <strong>A</strong> (rolling a 4 on a six-sided die) and <strong>B</strong> (drawing a red card from a deck), the joint probability would be the chance of both events happening simultaneously.</li></ul><p><strong>2. Marginal Probability</strong>:</p><ul><li>The marginal probability is the likelihood of an event happening without being influenced by any other event. It stands alone, independent of other outcomes.</li><li>For instance, if we want to find the probability of rolling a 4 on a die (regardless of other factors), that would be the marginal probability.</li></ul><p><strong>3. Conditional Probability</strong>:</p><ul><li>Conditional probability deals with the likelihood of one event occurring <strong>given that another event has already happened</strong>.</li><li>Mathematically, it is expressed as <strong>P(A | B)</strong>, where <strong>A</strong> is the event we’re interested in, and <strong>B</strong> is the condition.</li><li>For example, if we want to find the probability of drawing a red card from a deck <strong>given that we’ve already drawn a heart</strong>, that would be the conditional probability.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=56020a666c81" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[RegEx Functions and their Applications]]></title>
            <link>https://medium.com/@pavanreddy1828/regular-expression-231e8b491a23?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/231e8b491a23</guid>
            <category><![CDATA[regex-in-python]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Mon, 04 Mar 2024 16:38:22 GMT</pubDate>
            <atom:updated>2024-03-06T15:28:02.873Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/683/1*8lNzShL7rZ3FPifcs0KvIQ.png" /></figure><h3>Introduction:</h3><p>This article introduces regular expressions, commonly referred to as “regex.” While programmers and web designers are likely more acquainted with the functionalities of regular expressions, even some everyday PC users harness this powerful search tool for extracting text through matching specific words, characters, or patterns.</p><h3>What are Regular Expressions?</h3><p>Regular Expressions, often called “regex,” are sequences of characters that define a search pattern. They serve as powerful tools for matching complex text patterns with minimal effort, going beyond the capabilities of traditional search methods. Think of them as advanced wildcards. While most text editors can perform basic searches for specific words or character strings, they fall short when it comes to identifying varied patterns, such as different phone numbers or email addresses. Regular expressions, on the other hand, excel at handling these diverse scenarios and offer much more functionality for users, making them a valuable tool for beginners to explore.</p><p><strong>The Versatility of Regular Expressions: Addressing Text Processing Needs Efficiently</strong></p><ol><li><strong>Pattern Matching:</strong></li></ol><p>Regex enables the identification of specific patterns within text, allowing users to find occurrences of characters, words, or structures that follow a defined format.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/651/1*TcGGpCvIyK7XqawAd8ZTtg.png" /></figure><p><strong>2. Text Extraction:</strong></p><ul><li>Regular expressions help extract specific information or substrings from a larger body of text. This is particularly useful when dealing with unstructured data or when you need to retrieve specific details.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hx5N6h84GE_r9LxFJkmsGA.png" /></figure><p><strong>3. Text Validation:</strong></p><p>Regex is commonly employed for validating whether a given piece of text adheres to a certain format or structure. This is valuable for tasks like form validation, ensuring that user inputs meet specific criteria.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*ooKKlNXuu_fkBhzCyxNWzQ.png" /></figure><p><strong>4. Search and Replace:</strong></p><ul><li>Regular expressions are powerful tools for searching and replacing text. They allow for the identification of specific patterns and the replacement of matching instances with other text or characters.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*hCxgN8yDGsx_-_6ch70M1A.png" /></figure><p><strong>5. Data Cleaning and Transformation:</strong></p><ul><li>In data processing tasks, regex can be used to clean and transform text data. It helps standardize formats, remove unwanted characters, and prepare data for analysis.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*Y4Mb5wIOhjxiW-c0G8L9Tg.png" /></figure><p><strong>6. Parsing and Tokenization:</strong></p><ul><li>Regex aids in breaking down text into smaller units, known as tokens, based on defined patterns. This is crucial in natural language processing, parsing, and lexical analysis.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/799/1*Eaw4AWbraoDKypbR4sEFbw.png" /></figure><p><strong>7. URL and Email Extraction:</strong></p><ul><li>Regular expressions are commonly used to extract URLs and email addresses from text. This is valuable in web scraping, data mining, and email parsing applications.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/814/1*b67_NzjiKsI0EdQbKxjjJA.png" /></figure><p><strong>8. Code Refactoring:</strong></p><ul><li>Programmers use regex to perform efficient code refactoring by identifying and replacing specific code patterns. This is particularly useful for tasks such as renaming variables or updating code structures.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*k6wNknqWeFIkeF3dF8SW1A.png" /></figure><p><strong>9. Log Analysis:</strong></p><ul><li>In systems administration and log analysis, regular expressions help filter and extract relevant information from log files. This aids in troubleshooting, monitoring, and understanding system behavior.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/730/1*bzDKjy4a3RQhjPWqnlrVmg.png" /></figure><p><strong>10. Advanced File Operations:</strong></p><ul><li>Regular expressions are integrated into file-related operations, allowing for sophisticated file searches, filtering, and manipulation based on specified patterns</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yod9bHzweBCPnJCk4OIuDw.png" /></figure><h3>Meta Characters</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/754/1*OrSOHjDWiLRVNoJEa3JKbg.png" /></figure><p>., ^, $, *, +, ?, {, }, [, ], (, ), |, \</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*WyCWr_7edJ_ckIwZhV9HUQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*T2CW_XnfgYeaYuggHjXN5A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JqvT465pEMee9HUFgKySGg.png" /></figure><p>In regular expressions, groups are used to capture and group together parts of a pattern. There are two main types of groups:</p><ol><li><strong>Capturing Groups — </strong><strong>(X):</strong></li></ol><ul><li>Capture and store a specific part of the matched text.</li><li>Contents can be referenced later using back references.</li><li>Useful for extracting specific information from a pattern.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/966/1*_VK5zG9ZCyM7vuX1BMZ8Cw.png" /></figure><p><strong>2 . Non-Capturing Groups — </strong><strong>(?:X):</strong></p><ul><li>Group expressions without creating a separate captured group.</li><li>Contents are not stored for later use.</li><li>Improves performance and avoids unnecessary memory usage when capturing is unnecessary.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*0vMRKG5ui8DWMgk1EmwOlQ.png" /></figure><h3><strong>Applications of Regular Expressions</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/713/1*S2xUCI3-xAyAyqJLGrq70Q.png" /></figure><ol><li>Validating User Input</li><li>Find and Replace in Text Editors</li><li>Analyzing Log Files</li><li>Extracting Data from Websites</li><li>Cleaning and Transforming Data</li><li>Powering Search Engines</li><li>Validating and Parsing URLs</li><li>Tokenizing Source Code</li><li>Advanced Text Processing (NLP)</li><li>Network Security Rules</li><li>Database Querying and Validation</li><li>Formal Language Theory</li><li>Configuration File Validation</li><li>Extracting Document Metadata</li><li>URL Rewriting in Web Servers</li><li>DNA Sequence Pattern Matching</li></ol><p><strong>Regex Functions:</strong></p><p>In Python, the re module provides support for regular expressions. Here are some commonly used functions from the re module for working with regular expressions</p><p><strong>import regex as re</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/441/1*ew2bCgYG_Pa9fZ3HamONXw.png" /></figure><p>1.re.search(pattern, string):</p><ul><li>Searches for the first occurrence of a pattern in a string.</li><li>Returns a match object if a match is found, None otherwise.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/553/1*t36ZM3suzngi2-WguEV4mQ.png" /></figure><p>2.re.match(pattern, string):</p><ul><li>Attempts to match the pattern only at the beginning of the string.</li><li>Returns a match object if a match is found at the beginning, None otherwise.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/538/1*I39iV7gWkj9FnCDOdooO6Q.png" /></figure><p>3.re.findall(pattern, string):</p><ul><li>Finds all occurrences of a pattern in a string.</li><li>Returns a list of strings containing all matches.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/459/1*tKznta7NJIsABur3_z8Jeg.png" /></figure><p>4.re.sub(pattern, replacement, string):</p><ul><li>Searches for a pattern in a string and replaces it with the specified replacement.</li><li>Returns a new string with replacements.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/465/1*pAzS1_cXcrBhkPEQDQGFHA.png" /></figure><p>5.re.split(pattern, string):</p><ul><li>Splits a string into a list using the specified pattern as the delimiter.</li><li>Returns a list of substrings.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/363/1*dHLFMQAKHZZMfnqCBYEbpQ.png" /></figure><p><strong>6. Fullmatch() :</strong></p><p>This method returns the match object only if the pattern matches the entire string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/589/1*esSdbZ8vYE4g6iD-lSu-vQ.png" /></figure><p><strong>7.Split() :</strong></p><p>It is used to split the string into a list of substrings by the occurrences of the regex pattern.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/697/1*Dk0tEZ6N1SoFED6gi8_tAg.png" /></figure><p><strong>8. Finditer() :</strong></p><p>This method returns all the matches that were found from the given string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*vxG2RO0Vds39KG2QFTdsNQ.png" /></figure><p><strong>9. Sub() :</strong></p><p>This function is used to replace a substring with another substring.<br>In the below example, the spaces are replaced with commas.</p><p><strong>10.Escape() :</strong></p><p>This method automatically escapes all the metacharacters from a string.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/556/1*vpEODaQJ-qelR8jFK1z4AA.png" /></figure><p><strong>Regex task:</strong> <a href="https://github.com/pavan1828/Python-/blob/main/Regex%20task.ipynb">https://github.com/pavan1828/Python-/blob/main/Regex%20task.ipynb</a></p><p><strong><em>Conclusion :</em></strong></p><p>This article is about different types of RegEx Functions with examples and use cases. I hope you guys enjoyed learning it.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=231e8b491a23" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Power of Median Absolute Deviation: A Guide to Understanding Data Spread]]></title>
            <link>https://medium.com/@pavanreddy1828/unveiling-the-power-of-median-absolute-deviation-a-guide-to-understanding-data-spread-9a823e174457?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/9a823e174457</guid>
            <category><![CDATA[mean-absolute-deviation]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Sat, 13 Jan 2024 16:02:13 GMT</pubDate>
            <atom:updated>2024-01-13T17:06:29.150Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*QhoLwe0LGwyloknx-ev6Rw.png" /></figure><p><strong>Introduction:</strong></p><p>Welcome to the world of data analysis, where we often find ourselves wrestling with the challenge of outliers and extreme values. In this blog post, we will embark on a journey to explore and fully grasp the remarkable statistical tool known as Median Absolute Deviation (MAD). Brace yourself for a mind-bending adventure through the world of robust data analysis.</p><h3>The Essence of Median Absolute Deviation:</h3><p><strong>1. Definition:</strong></p><p>MAD measures the median of the absolute differences between each data point and the overall median of the dataset. This definition might sound complex, but let’s break it down.</p><h4>2. Robustness:</h4><p>MAD is a robust statistic, meaning it’s not easily swayed by outliers or extreme values. This makes it particularly useful in scenarios where data may have anomalies.</p><blockquote>Imagine a group of friends standing in a line, each holding a sign with a number on it.</blockquote><ol><li><strong>Find the middle friend:</strong></li></ol><ul><li>Arrange your friends in order from smallest number to largest number.</li><li>The friend standing exactly in the middle represents the median of the group.</li></ul><p>2.<strong> Measure the distances to the middle:</strong></p><ul><li>Ask each friend to measure how far away their number is from the middle friend’s number.</li><li>Don’t worry about whether they’re to the left or right, just focus on the distance.</li><li>These distances are called absolute deviations.</li></ul><p>3. <strong>Find the middle distance:</strong></p><ul><li>Arrange the distances in order, just like you did with the numbers.</li><li>The distance standing in the middle of this new line is the median absolute deviation (MAD).</li></ul><p>Here’s why MAD is like a superhero:</p><ul><li>It’s tough and resilient! Outliers (those super high or low numbers that stand way out from the rest) don’t affect it much.</li><li>It can handle skewed data (when most of the numbers are bunched up on one side).</li><li>It’s easy to understand and calculate, even without fancy tools!</li></ul><p><em>Think of MAD as the dependable friend who always stays close to the group, even when things get a little crazy!</em></p><h3>Decoding MAD’s Secret Formula:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/663/1*ngOA2w01HlrdWyJn_GRbKg.png" /></figure><h4>Step 1: Find the Median (M):</h4><ul><li>Arrange the data points in ascending order.</li><li>Identify the middle value, and if there’s an even count, average the two middle values. This is your median.</li></ul><h4><strong>Step 2: Calculate Absolute Deviation (AD):</strong></h4><ul><li>For each data point, measure the absolute difference between the data point and the median.</li><li>Ignore the direction; focus only on the distance.</li></ul><h4>Step 3: Determine the Median of Absolute Deviations (MAD):</h4><ul><li>Arrange the absolute deviations in ascending order.</li><li>The middle value in this new lineup is your Median Absolute Deviation (MAD).</li></ul><h3>A Cinematic Walkthrough — MAD in Action:</h3><p>Let’s walk through a detailed example of calculating the Median Absolute Deviation (MAD) with a set of data points. Suppose we have the following dataset representing test scores:</p><p>78,85,92,94,96,100</p><p>First, we arrange the data points in ascending order:</p><p>78,85,92,94,96,100</p><h4>Find the Median (M)</h4><p>Since there is an even number of data points (6 in total), we need to find the average of the two middle values. In this case, the two middle values are 92 and 94. Therefore, the median (M) is:</p><p>M =(92+94)/2 ==93</p><p>So, the median (M) is 93.</p><h4>Calculate Absolute Deviation (AD)</h4><p>Now, we calculate the absolute deviation for each data point by subtracting the median (M) from each data point and taking the absolute value:</p><p>∣78−93∣ =15</p><p>∣85−93∣ =8</p><p>∣92−93∣= 1</p><p>∣94−93∣= 1</p><p>∣96−93∣= 3</p><p>∣100−93∣= 7</p><h4>Median of Absolute Deviations (MAD)</h4><p>Next, we arrange the absolute deviations in ascending order:</p><p>1,1,3,7,8,151</p><p>The median of these absolute deviations is the middle value, which is 3. Therefore, the Median Absolute Deviation (MAD) for this dataset is 3.</p><p><strong>Conclusion:</strong></p><p>Median Absolute Deviation (MAD) proves to be a trustworthy companion in the realm of data analysis. Its robust nature makes it resilient to outliers, providing a reliable measure of how spread out our data is. With MAD as our ally, we gain a clearer understanding of data variability, empowering us to make informed decisions and navigate the complexities of real-world data analysis with ease. Happy analyzing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9a823e174457" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Z-Score and Outlier Detection in Non-Normal Distributions]]></title>
            <link>https://medium.com/@pavanreddy1828/z-score-and-outlier-detection-in-non-normal-distributions-bc3fe61a1935?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bc3fe61a1935</guid>
            <category><![CDATA[z-score]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Thu, 11 Jan 2024 22:13:25 GMT</pubDate>
            <atom:updated>2024-01-12T15:56:39.713Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*F2sx0zzB1hOYpF_OWytIOg.png" /><figcaption>Z-score</figcaption></figure><p><strong>Introduction to Z-Scores:</strong></p><p>Z-scores are like the superheroes of statistics, ready to rescue us from the clutches of outlier confusion! 🦸‍♂️📊 These magical numbers help us understand how far away a particular data point is from the average, sort of like a distance marker in a bustling city.</p><p><strong>Understanding Z-Scores:</strong></p><p>Imagine you’re at a concert, and you want to know how close or far you are from the stage. The stage represents the average, and your distance is your z-score! Now, let’s break it down:</p><ul><li><strong>Meaning:</strong> A z-score tells us how many standard deviations a data point is from the mean (average). If it’s positive, you’re on the right side of average; if negative, you’re on the left.</li><li><strong>Formula:</strong></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/297/1*9zlz8AJN0eAdgmHPd1CG8A.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*UnNBWbhvlxJpYV89CMcAGg.png" /><figcaption>Positive Z score table</figcaption></figure><h4>Normal Distribution and Z Scores</h4><h4>Normal Distribution:</h4><p>The normal distribution is like a perfectly balanced see-saw, where everything is in the middle. Imagine the mean, median, and mode as three friends sitting on the see-saw at the exact same spot.</p><p>Now, if these friends aren’t sitting in the middle and are a bit off-center, it’s like one side of the see-saw is heavier than the other. This imbalance makes the distribution either tilt to the left or the right. If it leans to the left, we call it negatively skewed, and if it leans to the right, it’s positively skewed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/705/1*IMSRWw1JAYBpB41zutOnZA.png" /></figure><h3><strong>Normal Distribution and Standard Deviation</strong></h3><p>Normal distribution, often referred to as the bell curve, is a common pattern observed in various phenomena like test scores, heights, or IQ scores. It’s symmetrical, resembling a bell-shaped curve, with the majority of values concentrated around the mean, or average.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/504/1*1QUH3j1ybM3LCwrtLbarwA.jpeg" /><figcaption>Bell Curve</figcaption></figure><p>Now, let’s talk about the sidekick of normal distribution: the standard deviation. Think of it as a measure of how spread out or tightly packed data points are around the mean.</p><p><strong>One Standard Deviation:</strong></p><ul><li>Imagine we’re looking at exam scores. If the mean score is 70 and the standard deviation is 5, one standard deviation above the mean (75) or below the mean (65) captures a significant chunk of scores. It’s like saying, “most scores are around 65 to 75.”</li></ul><p><strong>Two Standard Deviations:</strong></p><p>Move two standard deviations away, and you encompass even more scores. For our example, two standard deviations above (80) or below (60) the mean cover an even broader range.</p><p><strong>Three Standard Deviations:</strong></p><ul><li>Go three standard deviations out, and you’ve got an even wider spectrum. Three standard deviations above (85) or below (55) the mean include almost all the scores.</li></ul><p>Why does this matter? Well, the magic lies in the percentages. In a normal distribution:</p><ul><li>About 68% of scores fall within one standard deviation of the mean.</li><li>Around 95% fall within two standard deviations.</li><li>Nearly 99.7% fall within three standard deviations.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*p6huWW7bdjCaAn4atNR-Eg.png" /></figure><h3><strong>Z-score</strong></h3><p>Z scores, often referred to as standard scores, are a way to standardize data by expressing how many standard deviations a particular raw score is above or below the mean. we’re working with exam scores in a class where the mean score is 70.</p><p>For calculation, we use the formula:</p><p>Z = xMean/standard deviation</p><p>Now, let’s say the standard deviation is 5. If we want to convert a raw score of 75:</p><p>Z = 75–70 /5</p><p>This means a raw score of 75 is one standard deviation above the mean.</p><p>Similarly, for a score of 65:</p><p>Z = 65–70 /5</p><p>A raw score of 65 is one standard deviation below the mean.</p><p>Converting data to Z scores transforms the mean into 0 and the standard deviation into 1. The formula to convert Z scores back to raw scores is:</p><p>Raw score=(Z score×Standard Deviation)+Mean</p><p>For example:</p><p>Raw score=(1×5)+70=75</p><p>Understanding Z scores allows us to interpret data in standardized units, making comparisons and analysis more accessible. With a mean of 70, the Z scores guide us through the distribution, providing valuable insights into the relative position of each data point.</p><h3>Non Normal distributions</h3><p>A non-normal distribution is any statistical distribution that is not normal. Non-normal distributions can take many different shapes, including skewed, bimodal, and uniform. Non-normal distributions are more challenging to analyze than normal distributions because they do not have the same predictable patterns.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/259/1*9VGHZjbLUM_yGnxtJzx6vQ.png" /></figure><h3>Types of Non Normal distributions</h3><ol><li><strong>Exponential Distribution:</strong>The exponential distribution models the time between events happening at a constant rate, like arrivals at a service counter or machine failures. It’s useful for predicting waiting times. The only parameter, <em>λ</em> (lambda), represents the rate of events. High <em>λ</em> means events happen frequently. It’s a simple and powerful tool for scenarios involving continuous, independent events.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*KYcPqzv-iaWf6LckfgO54A.jpeg" /></figure><h3>Probability Density Function (PDF):</h3><p>The probability density function (PDF) of the exponential distribution is a function that describes the probability of a given value occurring under the distribution. The <a href="https://www.qualitygurus.com/pdf-cdf-and-pmf-probability-distribution-functions/">PDF</a> of the exponential distribution is defined as:</p><p>f(x)=λe−λx</p><p>where:</p><p>λ is the rate at which events occur</p><h3>Cumulative Density Function (CDF)</h3><p>The cumulative density function (<a href="https://www.qualitygurus.com/pdf-cdf-and-pmf-probability-distribution-functions/">CDF</a>) of the exponential distribution is a function that describes the probability of a value being less than or equal to a given value. The CDF of the exponential distribution is defined as:</p><p>F(x)=1−e−λx</p><p>where:</p><p>λ is the rate at which events occur.</p><h3>Mean, Median and Variance of Exponential Distribution:</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/863/1*7qeD757xWOZ_lrde89YvtA.png" /></figure><p>The exponential distribution is a useful tool for modelling the time between events that occur at a constant rate. It has several important properties, including the memoryless property and a right-skewed shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/978/1*0bdmZuAbrFyG6FmpTcpw2g.png" /><figcaption>Code for exponential distribution</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/970/1*S022BJ2jZWrHSa0tZRWWHg.png" /></figure><h3>Gamma Distribution:</h3><p>the Gamma distribution, derived from the normal distribution, is favored for situations with positive outcomes, often resulting in a skewed shape. It finds applications in diverse fields such as weather predictions and reliability assessments.</p><h3>Gamma Distribution Parameters</h3><p>The Gamma distribution is usually explained with two main factors: shape and scale. However, for a more precise description, a third factor called threshold can be added. The probability density function (PDF) is a math formula telling us how the values are spread. Essentially, it helps predict the likelihood of different outcomes. While the simpler two-factor system is common, the addition of a third factor allows for more detailed insights when needed, giving flexibility to adapt the Gamma distribution for various situations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*t2bN8k7aVZPq79eRaYy1ug.png" /></figure><h3>1. THE SHAPE PARAMETER:</h3><p>The shape parameter (<em>α</em>) in the Gamma distribution signifies the number of events being modeled. For example, setting <em>α</em> to four models a scenario involving four events, such as car accidents in a city. The shape parameter must be positive, but it doesn’t have to be an integer. Changing <em>α</em> influences the shape of the distribution, allowing us to tailor it to various scenarios.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*hyMgL6l7-AUnH6E6Ue1y1w.png" /></figure><h3>2. THE SCALE PARAMETER</h3><p>The scale parameter (<em>β</em>) in the Gamma distribution is like measuring the time between events, such as car accidents. If we model four accidents, it helps find the average time between them. Picture it as adjusting a hill’s height: a higher scale spreads the events more, creating a lower peak, while a smaller scale makes them more concentrated with a higher peak. Changing only the scale parameter gives us various Gamma distributions, showing how events are spread out or closely packed.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/807/1*hyMgL6l7-AUnH6E6Ue1y1w.png" /></figure><h3>3. THE THRESHOLD PARAMETER</h3><p>The third parameter in the Gamma distribution determines if the distribution can have negative values. Usually set to zero, it ensures the distribution only considers positive values, which makes sense in most real-world situations. When the other two parameters are fixed, this threshold parameter indicates what the distribution would look like for negative values. However, since the Gamma distribution is meant for positive values only, the value for negative values is always zero. In simpler terms, it’s a way of saying, “We only care about positive stuff!”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*iYhjU8L1R5jvjYlAfnetpg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/723/1*eVtXrlRD_VI0nshWSS3N4A.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dfctFlEfj_C8XRDvEfxmMA.png" /></figure><h3>Properties of Gamma Distribution</h3><p>If we look at the shape of the Gamma distribution, we can observe the following properties</p><ul><li>It approaches zero as time tends to infinity (theoretically).</li><li>For real numbers (n), the value of the Gamma distribution is the factorial of (n-1).</li><li>The value of the Gamma distribution of 1/2 is the square root of pi.</li></ul><h3>Skewed Distribution</h3><p><strong>Skewness</strong> is a measure of the asymmetry of a distribution. A distribution is asymmetrical when its left and right side are not mirror images.</p><p>A distribution can have right (or positive), left (or negative), or zero skewness. A right-skewed distribution is longer on the right side of its peak, and a left-skewed distribution is longer on the left side of its peak</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*fooV1VgVdzQahNvlbrQOFw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/330/1*BW94-SJSkz1irkrWPlnPBA.jpeg" /></figure><h3>What to do if your data is skewed</h3><p>If your data is skewed, consider applying transformations like logarithmic or square root transformations to reduce skewness. These methods can help stabilize variance and make the distribution more symmetrical. Additionally, identifying and addressing outliers can contribute to skewness, so removing or transforming outliers can be effective. Nonparametric methods and using alternative statistical models may also be considered for more robust analysis. Always evaluate the impact of these strategies on your specific dataset and choose the approach that best aligns with your analytical goals.</p><h3>Mean and Median in Skewed Distributions</h3><p>In a normal distribution, the <a href="https://www.statisticshowto.com/probability-and-statistics/statistics-definitions/mean-median-mode/#mean">mean </a>and the <a href="https://www.statisticshowto.com/probability-and-statistics/statistics-definitions/mean-median-mode/#median">median </a>are the same number while the mean and median in a skewed distribution become <em>different</em> numbers:</p><p>A left-skewed, negative distribution will have the mean to the <strong>left</strong> of the median.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*FuhP2kPHBT6IWsZ6u7sPOw.jpeg" /></figure><p>A right-skewed distribution will have the mean to the <strong>right </strong>of the median.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*R4-Ua5052Ycfh6yXolPABg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*j0wVDo2zkf-NiMxI9PV2Ig.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CZE39sxjLOXhZEBEzJFatw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bc3fe61a1935" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Missing Data in Pandas]]></title>
            <link>https://medium.com/@pavanreddy1828/missing-data-in-pandas-3a6143566727?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a6143566727</guid>
            <category><![CDATA[missing-data-in-pandas]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Wed, 10 Jan 2024 20:30:21 GMT</pubDate>
            <atom:updated>2024-01-11T05:04:35.920Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/784/1*RGzUk27Es6lYtUZd5up29w.png" /></figure><h3>Introduction:</h3><p><strong>Missing data</strong>, also known as <strong>missing values</strong>, arises when specific variables or participants lack recorded information. This situation can arise from a variety of factors, including incomplete data entry, malfunctions in equipment, lost files, and various other reasons. In essence, missing data occurs when information is absent or not available for certain aspects of a dataset, introducing challenges in the analysis process. Reasons for data being missing can range from human errors during data collection to technical issues with recording equipment, making it essential for data analysts to employ strategies for handling and mitigating the impact of these gaps in the dataset.</p><h3>Types of Missing Data:</h3><p>There are four types of missing data that are generally categorized.</p><ol><li>Missing completely at random (MCAR)</li><li>Missing at random</li><li>Missing not at random</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/654/1*pOGimVwbiR-7Z7KW5PI3VQ.jpeg" /></figure><ol><li><strong>Missing completely at random (MCAR):</strong></li></ol><p>Imagine you have a bunch of data, and some of it is missing. If the missing data is completely at random, it means there’s no special reason why certain information is missing. It’s as if someone flipped a coin for each piece of data to decide whether it will be there or not. There’s no pattern or system making some data more likely to be missing than others.</p><p>In other words, MCAR is like having a group of students where everyone has an equal chance of skipping class on any given day. There’s no connection between skipping class and any particular student or their characteristics — it’s just random who shows up and who doesn’t.</p><p>2.<strong>Missing at Random</strong>, <strong>MAR:</strong>means there is a systematic relationship between the propensity of missing values and the <em>observed</em> data, but <em>not</em> the missing data.</p><p>Whether an observation is missing has nothing to do with the missing values, but it does have to do with the values of an individual’s observed variables. So, for example, if men are more likely to tell you their weight than women, weight is MAR.</p><p><strong>3. Missing Not at Random(</strong> <strong>MNAR):</strong>means there is a relationship between the propensity of a value to be missing and its values. This is a case where the people with the lowest education are missing on education or the sickest people are most likely to drop out of the study.</p><p>MNAR is called “non-ignorable” because the missing data mechanism itself has to be modeled as you deal with the missing data. You have to include some model for why the data are missing and what the likely values are.</p><p>“Missing Completely at Random” and “Missing at Random” are both considered ‘ignorable’ because we don’t have to include any information about the missing data itself when we deal with the missing data.</p><h3>Identifying Missing Data</h3><p>Visualization Techniques:</p><p><strong>Heatmap</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*AgitQUhEWVFNYJa9uOYwpQ.png" /></figure><p><strong>Matrix</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/736/1*naAOdqdgHR280VVoWM-b_A.png" /></figure><h3>Histograms</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/732/1*eYTLCkzDVlEyw6vxEWr7CQ.png" /></figure><p>The isnull() and isna() functions are used interchangeably to check for missing or NaN (Not a Number) values in a DataFrame or Series. Both functions return a DataFrame or Series of the same shape as the input, where each element is True if the corresponding element in the original object is a missing or NaN value, and False otherwise.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/558/1*Y3SEt1P7Fgfi3e6ij0MuRA.png" /></figure><h3><strong>Handling Missing Data</strong></h3><p>Handling missing values is the process of addressing gaps in a dataset to ensure reliable analysis. Techniques include deleting affected rows, imputing missing values, or using special values. The goal is to maintain data integrity, prevent bias, and improve model performance. This is crucial for beginners in data analysis to produce accurate insights.</p><h4>Deletion:</h4><p>In pandas, both dropna() and drop() methods are used for removing missing values or specified rows/columns from a DataFrame, but they have distinct use cases:</p><ol><li>dropna() Method:</li></ol><p><strong>Purpose:</strong></p><ul><li>Primarily used for removing missing values (NaN) from a DataFrame.</li></ul><p><strong>Functionality:</strong></p><ul><li>Removes entire rows that contain at least one NaN value.</li><li>By default, it operates on rows (axis=0), but you can specify axis=1 to drop columns with NaN values<strong>.</strong></li></ul><p><strong>Syntax:</strong></p><p><em>dataframe</em>.dropna(axis, how, thresh, subset, inplace)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ibo63IAwT9a48vVjmmecdw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0cMTJumOqYvm-ZBja_mgrQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/893/1*FYHf8mFkbu5K8X0Mw8uvDQ.png" /></figure><p>2. drop() Method:</p><p><strong>Purpose:</strong></p><p>Used for removing specified rows or columns based on labels or index.</p><p><strong>Functionality:</strong></p><ul><li>Can remove rows (axis=0) or columns (axis=1) based on labels or index.</li><li>Does not specifically focus on removing NaN values; instead, it removes rows or columns based on labels or index values.</li></ul><p><strong>Syntax:</strong></p><p><em>dataframe</em>.drop(<em>labels</em>, axis, index, columns, level, inplace., errors)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ADUSB-gFEGyV8WTWbXTkvw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xx7-ie-anWmze9JhdWVA_A.png" /></figure><p><strong>Imputation:</strong></p><p>The fillna() method replaces the NULL values with a specified value.</p><p>The fillna() method returns a new DataFrame object unless the inplace parameter is set to True, in that case the fillna() method does the replacing in the original DataFrame instead.</p><p><strong>Syntax:</strong></p><p><em>dataframe</em>.fillna(value, method, axis, inplace, limit, downcast)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_obm8wLakrL7O5ndqCLqXw.png" /></figure><p>→Mean, Median, or Mode Imputation: Fill missing values with the mean, median, or mode of the respective column.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/673/1*Cd_YAKFOOHjNKQX_sEkWiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*rpBvm67K_E3Mm8HgXKSmFA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*01NWtOT8i5Lq1YBneKyYIw.png" /></figure><p>→Forward or Backward Fill (fillna(method=&#39;ffill&#39;/&#39;bfill&#39;)): Use the previous or next valid observation to fill missing values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/628/1*70mxaKCMvnayVWHFq1PYTA.png" /></figure><p>→Interpolation (interpolate()): Fill missing values by estimating values based on other data points.</p><p><strong>Syntax:</strong></p><p><em>dataframe</em>.interpolate(method, axis, inplace, limit, limit_direction, limit_area, downcast, <em>kwargs</em>)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*okRb8LSD5two_T52eCK9qA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/1*1RppCieAjzX5ZhBx43NDmw.png" /></figure><p>The concepts of introducing a S<strong>pecial value</strong> and using D<strong>omain-specific</strong> methods can be applied to both string (categorical) and numeric data, depending on the nature of the dataset and the specific characteristics of the columns. Let’s discuss how these concepts can be applied to both types of data</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*U4r0gzTeALNrSKMSN7q_DQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1008/1*T9XdADGu_1-JdP-q4dOhlg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/898/1*oQ1omSEwlPcQp1l63_5vgw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RfBwkFNDHq0E43FQsmxvmA.png" /></figure><p><strong>Advantages Filling missing values in a dataset :</strong></p><ul><li><strong>Preserves valuable information: </strong>By filling gaps, you maximize the data available for analysis, preventing information loss and maintaining statistical pow<strong>er.</strong></li><li><strong>Improves data quality and consistency: </strong>Complete datasets are easier to analyze, interpret, and visualize, leading to clearer insights and more reliable results.</li><li><strong>Enhances model performance:</strong> Machine learning algorithms often perform better with complete data, resulting in more accurate predictions and efficient model training.</li><li><strong>Expands analytical possibilities:</strong> Filling missing values unlocks a wider range of statistical techniques and machine learning methods, enabling deeper exploration of your data.</li></ul><p><strong>Disadvantages Filling missing values in a dataset :</strong></p><ul><li><strong>Masking insights:</strong> Imputed values might hide patterns or reasons for missing data, obscuring valuable underlying information.</li><li><strong>Introducing bias: </strong>Assumptions used to fill gaps can skew the data, leading to misleading conclusions and biased results.</li><li><strong>False sense of certainty: </strong>Filled data can create an illusion of completeness, masking uncertainty and potentially overstating findings.</li><li><strong>Increased complexity:</strong> Choosing the right imputation method requires careful consideration, adding complexity to the analysis process.</li></ul><p><strong>Conclusion:</strong></p><ul><li><strong>NumPy Limitation</strong>:NumPy lacks a built-in way to handle missing data for non-floating-point data types.</li><li><strong>Pandas Handling</strong>:Pandas is a helpful tool for managing missing data in various types of datasets.</li><li><strong>Identification Techniques</strong>:Use functions like isnull() and notnull() in Pandas to identify missing values in your dataset.</li><li><strong>Handling Missing Values</strong>:Employ methods like dropna() to remove entries with missing values and fillna(), replace(), and interpolate() to substitute alternative values.</li><li><strong>Versatility of Interpolate()</strong>:The interpolate() function in Pandas is particularly useful for filling in gaps in a dataset by using midpoints between existing points.</li><li><strong>Analyst’s Choice</strong>:Analysts have the flexibility to choose between ignoring missing values or replacing them with appropriate values, depending on the dataset and analysis goals.</li><li><strong>Critical Role</strong>:Dealing with missing data is crucial for ensuring the reliability and accuracy of data analysis results.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a6143566727" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PYTHON PANDAS]]></title>
            <link>https://medium.com/@pavanreddy1828/python-pandas-381412a4b32a?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/381412a4b32a</guid>
            <category><![CDATA[installation]]></category>
            <category><![CDATA[datastrcture]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[introduction]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Sun, 07 Jan 2024 11:56:39 GMT</pubDate>
            <atom:updated>2024-01-25T11:32:24.647Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_vbV9OfTLG7FxY1Yt68PeA.png" /></figure><h3><strong>Introduction</strong>:</h3><p>Pandas or Python Pandas is a library of Python which is used for data analysis.</p><p>The term Pandas is derived from “Panel data system” , which is an ecometric term for multidimentioal, structured data set ecometrics.</p><p>Now a days, Pandas has become a popular option for Data Analysis.</p><p>Pandas provides various tools for data analysis in simpler form.</p><p>Pandas is an Open Source, BSD library built for Python Programming language.</p><p>Pandas offers high performance, easy to use data structure and data analysis tools.</p><p>The main author of Pandas is Wes McKinney.</p><h3><strong>INSTALLING PANDAS</strong></h3><p><strong>Using ‘pip’:</strong></p><p><strong>1.Open a Terminal or Command Prompt:</strong></p><ul><li>On Windows, press Win + R, type cmd, and press Enter.</li><li>On macOS or Linux, open the Terminal.</li></ul><p><strong>2.Install Pandas:</strong></p><ul><li>pip install pandas</li></ul><h3>Using conda:</h3><ol><li>Open a Terminal or Command Prompt:</li><li>Create a New Conda Environment (Optional but Recommended):</li></ol><ul><li>conda create — name myenv</li><li>conda activate myenv</li></ul><p><strong>Install Pandas:</strong></p><ul><li>conda install pandas</li></ul><h3><strong>Features of Pandas</strong></h3><ul><li>Pandas, is the most popular library in Scientific Python ecosystem for doing data analysis. Pandas is capable of many taska including</li></ul><p>1. It can read or write in many different data formats(Integer, float, double etc).</p><p>2. It can calculate in all ways data is organized.</p><p>3. It can easily select subsets of data from bulky data sets ab=nd even combine multiple datasets together.</p><p>4. It has functionality to find anfd fill missing data.</p><p>5. It allows you to apply operations to independent groups within the data.</p><p>6. It supports reshaping of data into different forms.</p><p>7. It supports advanced time-series functionality(which is the use of a model to predict future values based on previously observed values).</p><p>8. It supports visualization by integrating matplotlib and seaborn etc libraries. Pandas is best at handling huge tabular data sets comprising different data formats.</p><h3><strong>Pandas Data Structure</strong></h3><p>“A data structure is a particular way of storing and organizing data in a computer so that it can be accessed and worked with in appropriate ways”</p><h3>The pandas Series</h3><p>The <strong><em>Series </em></strong>object represents one-dimensional data structures in Pandas. A series consists of two components.</p><ul><li><strong>One-dimensional data (Values)</strong></li><li><strong>Index</strong></li></ul><p>The series is composed of two arrays associated with each other. The main array (array of values) holds <strong>one-dimensional data</strong> to which each element is associated with a label, contained within the other array (array of labels), called the <strong>index</strong>. If you want to individually see the two arrays that make up the series, you can call <strong><em>index</em></strong> and <strong><em>values</em></strong> attributes of the series. Because a series is one dimensional, it has a single axis (dimension) — the index and the values of the index — 0, 1, 2, 3 — are called axis labels.</p><h3><strong>Series creation: Introduction</strong></h3><p>The general construct for creating a Series data structure is:</p><p><em>pandas. series(data,index=,dtype=,copy=)</em></p><p>Here, <strong><em>data</em></strong> can be one of the following:</p><ul><li><strong>A one-dimensional ndarray</strong></li><li><strong>A Python list</strong></li><li><strong>A Python dictionary</strong></li><li><strong>A scalar value</strong></li></ul><h4>Series creation: Using a one-dimensional ndarray</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-SMGr-20RpBo7BIzECfECA.png" /></figure><p>When you make a Pandas Series without picking specific labels, it defaults to using numbers (starting from 0) as labels. These numbers represent the order of items in the Series. To make it more beginner-friendly and understandable, you can set your own labels using the index parameter. Just make a list of labels that matches the length of your data, making your Series easier to work with and comprehend.&quot;</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3tvJ_klYMpyD1GFu0OI64A.png" /></figure><h3><strong>Note:</strong></h3><p>The values in a Pandas Series can store various data types such as strings, integers, floats, and booleans.</p><p>Additionally, the data type of Series values can be specified during creation using the dtype parameter, requiring a valid data type.</p><h3>Series creation: Using a Python list</h3><p>To create a series using a Python list, you can just pass a list to the <strong><em>data </em></strong>parameter of the <strong>Series()</strong> class constructor.</p><h3>Series creation: Using a Python dictionary</h3><p>To create a series using a Python dictionary, you can just pass a dictionary to the <strong><em>data</em></strong> parameter of the <strong>Series()</strong> class constructor. This time, the arrays of the index and values are filled with the corresponding keys and values of the dictionary.</p><h3>Series creation: Using a scalar value</h3><p>we can also create a Series from a scalar value. If you do not specify the <strong><em>index</em></strong> argument, the default index is 0. If you specify the <strong><em>index</em></strong>, the value will be repeated for specified index values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/885/1*AbOIdDzZ-zP8kBpfMwtGTg.png" /></figure><h3>Selecting elements from a Series</h3><p>The indexing and slicing that are applicable to NumPy arrays can be extended to the series because pandas library was built on top of NumPy.</p><ul><li>You can select a single element using the index number or index label of the series.</li><li>You can use the slice <strong>:</strong> notation with index numbers to select a range of elements from a series.</li><li>You can also use a list of index numbers or index labels to select multiple elements from a series.</li><li>You can also use the conditions and Boolean operators to select elements from a series.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/725/1*7ib5DSU4aN06L1JEjMV2Ig.png" /></figure><h3>Assigning values to the elements</h3><p>Series are <strong>mutable</strong>, which means that you can change the value of an element in the series after it has been initialized.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*MsOr6ReItejgCxSeNhvbTw.png" /></figure><h3>Operations and mathematical functions on series</h3><ol><li>*<em>Operations (+, -, , /):</em></li></ol><ul><li>Just like you can add, subtract, multiply, and divide individual numbers, you can perform these operations on entire series in pandas.</li><li>Example: result_series = series1 + series2 adds corresponding elements of two series and stores the result in a new series.</li></ul><p>2. Mathematical Functions (e.g., np.sqrt()):</p><ul><li>Functions that work on single numbers in NumPy (like square root) can be applied to entire series in pandas effortlessly.</li><li>Example: result_series = np.sqrt(series) calculates the square root of each element in the series and stores the results in a new series.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/458/1*DNpQsQHyL9PzSHSn1NmXqQ.png" /></figure><h3>DataFrame creation: Introduction</h3><p>A DataFrame is like a table where data is organized in rows and columns, with each column having a name and each row having a unique label, allowing for easy manipulation and analysis of structured data.</p><h3>Creation:</h3><ul><li>You can create a DataFrame from various sources (lists, dictionaries, NumPy arrays, etc.), and it’s commonly used in data analysis tasks, providing a powerful and flexible tool for handling and exploring datasets in Python.</li></ul><p><em>pd.DataFrame(data,index=,columns=)</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/887/1*tveiyF8ddZrtPyOLRMkvXA.png" /></figure><h3>DataFrame creation: Using a dictionary of dictionaries</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/704/1*V3QxnreyZPsKxq-LKQzO0g.png" /></figure><h3>DataFrame creation: Using a dictionary lists</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/925/1*EaCb5js8k0qd2hcVrpAQ-A.png" /></figure><h3>DataFrame creation: Using pandas read_*</h3><p>Pandas offers a variety of file format support, including CSV, Excel, SQL, and JSON, each with corresponding read_* functions for seamlessly importing data into a DataFrame.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iA_fozFqozuPD8Ok095hzQ.png" /></figure><p>The pd.read_csv() function in pandas facilitates the conversion of data from a comma-separated values (CSV) file or a plain text file into a DataFrame, enabling efficient handling and analysis of tabular information.</p><p>The pandas read_excel() function is designed to import data from an Excel file into a DataFrame, providing a seamless mechanism for working with spreadsheet-based information.</p><p>The pd.read_html() function in pandas serves the purpose of extracting and converting HTML tables into a pandas DataFrame, offering a convenient way to work with tabular data embedded in HTML documents.</p><p>The pandas read_sql() function is tailored to effortlessly fetch data from a SQL query or a database table, converting the retrieved information into a DataFrame for convenient manipulation and analysis.</p><p><strong><em>pd.read_csv</em></strong><em>(filepath_or_buffer, sep=’ ,’ , header=’infer’, index_col=None, usecols=None, engine=None, skiprows=None, nrows=None)</em></p><h3>Assigning values to the elements and adding new columns</h3><p>DataFrames in pandas possess both value mutability and size mutability. This flexibility allows for the modification of existing values within the DataFrame, as well as the addition or deletion of columns, providing dynamic control over the data structure and content.</p><p><strong>Value mutability:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*JP3K1xHRMjBU1lPfyPEkAQ.png" /></figure><p><strong>Adding new rows and columns</strong></p><p>Each column in a DataFrame can be thought of as a Series.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/354/1*JP3K1xHRMjBU1lPfyPEkAQ.png" /></figure><h3><strong>A Pandas Panel</strong></h3><p>A pandas Panel is like a 3D array, but it’s not commonly used, especially for beginners. It’s a bit more complex to display or visualize due to its 3D nature. Typically, Panels are employed for handling 3D time-series data. The three axes in a Panel are named as follows:</p><ul><li>items: Think of this as the first dimension. Each item represents a DataFrame.</li><li>major_axis: This is the second dimension. Each item corresponds to the rows of the DataFrame.</li><li>minor_axis: The third dimension. Each item corresponds to the columns of each DataFrame.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=381412a4b32a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Operators,Assignment &Bitwise Operator]]></title>
            <link>https://medium.com/@pavanreddy1828/operators-assignment-bitwise-operator-bfa2fc7eda65?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/bfa2fc7eda65</guid>
            <category><![CDATA[operators]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Mon, 16 Oct 2023 15:15:36 GMT</pubDate>
            <atom:updated>2023-10-16T15:15:36.411Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HV126fos6jY3XrG8bIv2VQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cdzB7n1xQBeSyZKpRPLYsg.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A81-4UvgJapjgOyIj7K__g.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8xKfgnffZGfJWQxq2clIew.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bfa2fc7eda65" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DATA TYPES IN PYTHON]]></title>
            <link>https://medium.com/@pavanreddy1828/data-types-in-python-f85dcbc79e50?source=rss-ae416c7594e3------2</link>
            <guid isPermaLink="false">https://medium.com/p/f85dcbc79e50</guid>
            <category><![CDATA[data-types-in-python]]></category>
            <dc:creator><![CDATA[Pavan kumar reddy]]></dc:creator>
            <pubDate>Thu, 12 Oct 2023 09:51:15 GMT</pubDate>
            <atom:updated>2023-10-12T09:51:15.312Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*O8-_Y59QuVZHnXBOVvCuJQ.png" /><figcaption>PYTHON DATA TYPES</figcaption></figure><h3><strong>Data Types :</strong></h3><p>The purpose of Data Types in Python is that “To Store the inputs in the main memory of the computer by allocating sufficient amount of memory space”.</p><h3><strong>Numeric data type:</strong></h3><ul><li>Numeric data type represents numeric data such as Integers,Floating point &amp;Complex numbers</li></ul><h3><strong>Integers:</strong></h3><ul><li>Integers are represented by <strong>int</strong> class</li><li>The purpose of int data type is that “ To store Integer Data OR Integral Value OR Whole Numbers (Numbers without Decimal Places)”.</li><li>Can be <strong>negative</strong> or <strong>postive</strong> numbers</li><li>In python ,Integers can be any length</li></ul><h3><strong>Floating Point:</strong></h3><ul><li>Float contains both <strong>integer</strong> and <strong>fractional part</strong></li><li>The purpose of float data type is that “To Store Real Constant Values / Floating Point Values(Numbers with Decimal Places) “</li><li>Can be <strong>negative</strong> or <strong>postive</strong> numbers</li></ul><h3><strong>Complex:</strong></h3><ul><li>The purpose of Complex Data Type is that “To Store Complex Values”.</li><li>The General Notation of Complex Values is show bellow.</li></ul><p>varname= a + bj</p><p>(OR)</p><p>varname= a — bj</p><p>=&gt;here ‘a’ is called Real Part</p><p>=&gt;Here ‘b’ is called Imginary Part</p><p>=&gt;The letter ‘j’ represents sqrt(-1)</p><h3><strong>Sequence Data Types:</strong></h3><ul><li>The purpose of Sequence Data Types is that “<strong>To Store or Organize Sequence of Values</strong>”.</li><li>The different types of containers used to store the data are <strong>String,List</strong> and <strong>Tuple</strong></li></ul><h3><strong>string :</strong></h3><ul><li>The purpose of string data type is that “To store String data or text data or Alphanumeric data or numeric data or special symbols within double Quotes or single quotes or tripple double quotes and tripple single quotes. “</li><li>Python string belong to <strong>str</strong> class</li></ul><h4>Indexing:</h4><p>The Process of Obtaining a single Value from str object is called Indexing .<br>=&gt;Index can be either +ve or -ve</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/406/1*Ax6aLN_9ftALeTHgGuMGYQ.png" /></figure><h4>Slicing:</h4><p>The Process of Obtaining Range of Characters / Sub String from Given Main String Data is called Slicing .</p><h3><strong>List :</strong></h3><ul><li>The purpose of list data type is that “To Store Multiple Values of Same Type or Different Type or Both the types in single object with Unique and Duplicate.</li><li>The Data in List object Stored / Organized within Square Brackets [ ] and They must be separated by Comma.</li><li>An object of list maintains Insertion Order.</li><li>On the object of list, we can perform Both Indexing and Slicing Operations</li><li>An an object of List belongs to Mutable bcoz Updation done at Same Address.</li></ul><h3>Tuple:</h3><ul><li>The purpose of tuple data type is that “To store Multiple Values either of Same type or Different Types or Both Types with Unique and Duplicates in single object (Constant Values)”.</li><li>The elements of tuple must be stored or organized within parentheses ()and Elements separated by comma.</li><li>An object of tuple maintains Insertion Order</li><li>An object of tuple belongs to Immutable because tuple’ object does not support item assignment.</li><li>On the object of tuple, we can perform both Indexing and Slicing Operations.</li></ul><h3>Set:</h3><ul><li>The purpose of set data type is that “To Store Multiple Values either of Same Type or Different type or Both the Types into single object with Unique Values (Duplicates are not allowed)”.</li><li>The Elements / Data of set Must be Organized OR Stored within Curly Braces {} and the Values must be separted by comma.</li><li>Set Elements are Un-ordered</li><li>On the object of set , we can’t perform Indexing and Slicing Operations becuase set never maintains Insertion Order.</li><li>An object of set belongs to Both Mutable in the case of adding the elements and Immutable in the case of Item Assignment.</li></ul><h3>Dictionary:</h3><ul><li>Dictionaries are used to store data values in key:value pairs.</li><li>A dictionary is a collection which is ordered, changeable and do not allow duplicates.</li></ul><h3>Mutable and Immutable</h3><h4>Mutable:</h4><ul><li>A Mutable Object is one, whose content can be Changed at SAME ADDRESS.<br><strong>Examples:</strong> list,set,dict</li></ul><h4><strong>Immutable:</strong></h4><p>Immutable Object does not allows to Change Its Content at Same Address( Content Can be Changed and Changed Value placed at NEW Address)<strong><br>Examples:</strong> int, float,bool,complex,str,</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f85dcbc79e50" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>