<?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 Yash Jadhav on Medium]]></title>
        <description><![CDATA[Stories by Yash Jadhav on Medium]]></description>
        <link>https://medium.com/@yashvj2222?source=rss-7a798b411dfe------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*X5TcAvl366mEQKgAsXTnnQ.png</url>
            <title>Stories by Yash Jadhav on Medium</title>
            <link>https://medium.com/@yashvj2222?source=rss-7a798b411dfe------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 22 Nov 2026 19:41:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yashvj2222/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[Polars vs. Pandas: Revolutionizing Data Processing in Python]]></title>
            <link>https://medium.com/@yashvj2222/polars-vs-pandas-revolutionizing-data-processing-in-python-14ad90e29f7e?source=rss-7a798b411dfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/14ad90e29f7e</guid>
            <category><![CDATA[polar]]></category>
            <category><![CDATA[librarycomparison]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[optimizedataprocessing]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Yash Jadhav]]></dc:creator>
            <pubDate>Sat, 30 Nov 2024 12:49:02 GMT</pubDate>
            <atom:updated>2024-12-01T06:00:00.302Z</atom:updated>
            <content:encoded><![CDATA[<h4>In-depth Explanation about Polars vs Pandas</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D8vPhWxLB3vbbfFhiNji8Q.jpeg" /></figure><h4>Introduction</h4><p>When we use Pandas , You ever noticed that reading files in pandas takes more time when the dataset is large. This becomes headache for most of the developers. In this scenario, Polars came into picture.</p><blockquote>Polars is a lightning-fast library that can handle data frames significantly more quickly than Pandas</blockquote><h4>Polars Installation</h4><pre># Python<br>!pip install polars  <br><br># Rust<br>[dependencies]<br>polars = { version = &quot;x&quot;, features = [&quot;lazy&quot;, ...]} <br><br># JavaScript<br>const pl = require(&#39;nodejs-polars&#39;);</pre><h4>Pandas Installation</h4><pre>!pip install pandas #Python</pre><h4><strong>Key Differences</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*3l6u0_XVxMYmtRNbZpFHpw.png" /><figcaption>Pandas vs Polars</figcaption></figure><h4>Reading Parquet File</h4><p>Now we will compare both pandas and polars in reading a <strong><em>Parquet file</em></strong>.</p><pre>pd.read_parquet(r&quot;\sample.parquet&quot;)   # Pandas<br><br>pl.read_parquet(r&quot;\sample.parquet&quot;)   # Polars</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*nmjQZPQkZ3nLeTbKIxF3hA.png" /><figcaption>Reading Parquet File</figcaption></figure><p>The difference between reading parquet file is <strong>mostly similar. </strong>Pandas take <strong>0.24 sec</strong> while Polars take <strong>0.12 sec</strong></p><h4><strong>Reading CSV file :</strong></h4><p>Now we will compare both pandas and polars in reading a <strong><em>CSV file</em></strong> size is <strong>1.66 GB</strong></p><pre>pd.read_csv(r&quot;\demo.csv&quot;)   # Pandas<br><br>pl.read_csv(r&quot;\demo.csv&quot;)   # Polars</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*S7CRvIbU-24elzMEa0u5fw.png" /><figcaption>Reading a CSV file</figcaption></figure><p>If you see , time difference is <strong>very high </strong>when we read a csv file. Pandas take 95.5 sec but <strong>Polars take only 12 sec </strong>to read 1.66 GB CSV file</p><h4>Aggregation Operations</h4><p>Now we will compare Aggregation Operations with pandas and polars</p><pre>#Pandas<br>df_pandas[&quot;Violation Code&quot;].mean() <br>df_pandas[&quot;Violation Code&quot;].median()<br>df_pandas[&quot;Violation Code&quot;].std()<br><br>#Polars<br>df_polars.select(pl.col(&quot;Violation Code&quot;).mean())<br>df_polars.select(pl.col(&quot;Violation Code&quot;).median())<br>df_polars.select(pl.col(&quot;Violation Code&quot;).std())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*HDs32CMbdEXOYJyG4IP6Cg.png" /><figcaption>Aggregation Comparison</figcaption></figure><p>If you see above comparison, Polars takes <strong>less time</strong> when calculating MEAN, MEDIAN and Standard Deviation</p><h4>Memory Usage</h4><p>We will compare the <strong>memory usage</strong> needed for <strong>reading the csv file</strong> with pandas and polars . Csv file size is same which we use while reading the csv file in above section</p><pre>def pandas_memory():<br>    df = pd.read_csv(&quot;large_dataset.csv&quot;)<br><br>def polars_memory():<br>    df = pl.read_csv(&quot;large_dataset.csv&quot;)<br><br>print(&quot;Pandas Memory:&quot;, memory_usage(pandas_memory))<br>print(&quot;Polars Memory:&quot;, memory_usage(polars_memory))</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*9x7J65rge_PD7cSYwo5EjQ.png" /><figcaption>Memory Usage while reading a CSV file</figcaption></figure><p>As we can see in analysis, <strong>Polars </strong>takes <strong>less memory usage</strong> for reading a CSV file ( size = 1.66 GB ) as compared to pandas</p><h4>Filtering and Aggregation</h4><p>Now we will filter some records from dataset (size = 1.66 GB) and perform aggregations like MEAN and MEDIAN</p><pre>#Pandas<br>filtered_pandas = df_pandas[df_pandas[&quot;Violation Code&quot;] &gt; 20]<br>filtered_pandas[&quot;Violation Code&quot;].mean()<br>filtered_pandas[&quot;Violation Code&quot;].median()<br><br>#Polars<br>filtered_polars = df_polars.filter(pl.col(&quot;Violation Code&quot;) &gt; 20)<br>filtered_polars.select(pl.col(&quot;Violation Code&quot;).mean())<br>filtered_polars.select(pl.col(&quot;Violation Code&quot;).median())</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*tU98LGG-YeiILdY2Tif84Q.png" /></figure><p>As we can see in above analysis, while filtering and aggregation polars take more time to filter the records and calculate mean but for median polars take less time</p><h4>Sorting Operation</h4><p>We will sort one column data in ascending order and calculate how much time is needed for pandas and polars</p><pre>#Pandas<br>df_pandas.sort_values(&quot;Violation Code&quot;, ascending=True)<br><br>#Polars<br>df_polars.sort(&quot;Violation Code&quot;, descending=False)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*G2N55ngn-CPxx6PZ3lM3Xg.png" /><figcaption>Sorting Comparison</figcaption></figure><p>But In sorting as you can see <strong>Polars</strong> take <strong>slightly more time</strong> than pandas.<br>This can be happen due to <strong>multi-threading and columnar format</strong> overheads in Polars</p><h4>What makes Polars fast ?</h4><p>Lazy Evaluation</p><ul><li>Polars defers computation until the result is required, allowing it to optimize query plans and eliminate unnecessary calculations.</li></ul><p>Multi-threading</p><ul><li>Polars is designed to leverage multi-core CPUs, enabling parallel execution of tasks for faster processing.</li></ul><p>Optimized Backend</p><ul><li>Polars’ Rust backend allows it to execute operations closer to the hardware with fewer abstractions, significantly boosting speed.</li></ul><p>These above are some of the factors which makes Polars Fast.</p><h4>Conclusion</h4><p>Both Polars and Pandas are powerful tools for data manipulation and analysis. While Pandas has been the industry standard for years due to its ease of use, Polars is quickly gaining traction as a modern alternative optimized for speed, efficiency, and scalability.</p><ul><li><strong>Choose Pandas</strong> if you are working with small to medium-sized datasets and when you need a well-established library with extensive community support.</li><li><strong>Polars</strong> when dealing with large datasets, performance-critical applications, or when you need to process data at scale using modern hardware efficiently.</li></ul><p>Polars’ features like <strong>multi-threading</strong>, <strong>lazy evaluation</strong> make it a clear <strong>winner</strong> for complex workflows and large-scale data processing.</p><h4>Polars URLS</h4><p>Website : <a href="https://pola.rs/">Polars</a><br>Documentation : <a href="https://docs.pola.rs/">Polars</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=14ad90e29f7e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Real-World Applications of the Golden Ratio: A Byproduct of the Fibonacci Series]]></title>
            <link>https://medium.com/@yashvj2222/real-world-applications-of-the-golden-ratio-a-byproduct-of-the-fibonacci-series-e7747aa8670c?source=rss-7a798b411dfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7747aa8670c</guid>
            <category><![CDATA[real-world-example]]></category>
            <category><![CDATA[fibonacci-sequence]]></category>
            <category><![CDATA[fibonacci]]></category>
            <category><![CDATA[golden-ratio]]></category>
            <dc:creator><![CDATA[Yash Jadhav]]></dc:creator>
            <pubDate>Mon, 26 Aug 2024 10:06:30 GMT</pubDate>
            <atom:updated>2024-08-26T10:15:03.500Z</atom:updated>
            <content:encoded><![CDATA[<h4>How the Golden Ratio Shapes our World !!</h4><h4>Fibonacci series:</h4><p>The Fibonacci series is a sequence of numbers where each number after the first two is the sum of the two preceding ones. It typically starts with 0 and 1, and the sequence progresses as follows:</p><p>0,1,1,2,3,5,8,13,21,34,…</p><p>Formally, the Fibonacci sequence is defined by the recurrence relation:</p><blockquote>F(n)=F(n−1)+F(n−2)</blockquote><p>with the initial conditions:</p><p>F(0)=0,F(1)=1</p><h4>Golden Ratio :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*PwyQ6m6jP6U159Jix_M3WQ.png" /><figcaption>Greek Alphabet “phi”</figcaption></figure><p>The Golden Ratio is defined as the ratio of consecutive Fibonacci numbers as the sequence progresses toward infinity. The Golden Ratio, denoted as <strong>φ (phi)</strong></p><p>Mathematically, if F(n) represents the n-th Fibonacci number, then the Golden Ratio is expressed as:</p><blockquote><strong>ϕ= F(n+1)​ / F(n)</strong></blockquote><p>As n increases, the ratio F(n+1) / F(n) approaches approximately <strong>1.618</strong>, which is the value of the Golden Ratio.</p><h4>Fibonacci Spiral :</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/680/1*POp7b5z1p0MYafmIB1EA3w.png" /><figcaption>The Fibonacci spiral: Approximating the harmonious golden ratio</figcaption></figure><p>Above Fibonacci spiral which is an approximation of the golden ratio, spiral start with the Fibonacci sequence: 0, 1, 1, 2, 3, 5, 8, 13, and so on. To get this spiral draw squares with sides equal to the Fibonacci numbers, beginning with a small square with side length 1. Add another square of side 1 next to it, forming a 1x2 rectangle. Next, draw a square with side length 2 (the next Fibonacci number) adjacent to the previous squares, continuing this pattern by adding squares with side lengths of 3, 5, 8, etc.</p><p>Below are some real world applications:</p><h4>Golden Ratio in Nature :</h4><p>The Golden Ratio is seen in the spiral patterns of shells. These shells grow in a spiral where each turn is about 1.618 times wider than the previous one, maintaining a consistent and beautiful shape.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*MtdHvqJPR1bcTF_-YbNu_Q.jpeg" /><figcaption>Shells</figcaption></figure><p>we don’t just see this golden ratio sequence on a small scale — this ratio is the mathematical sequence in the spirals of our storms, tornadoes, hurricanes; these all spin in the same golden ratio of 1 to 1.6</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yGxGLRoO95GAahjzc8Q_cQ.jpeg" /><figcaption>Tornado</figcaption></figure><p>The wings of many butterfly species exhibit proportions that approximate the Golden Ratio. If you measure the ratio of the length of the forewing to the hindwing, or even different segments of the wings, this ratio often closely approximates φ (approximately 1.618)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/945/1*Gv2CnlQs7kuFfEWof6RPiQ.jpeg" /><figcaption>Butterfly</figcaption></figure><p>The number of petals in some flowers is a Fibonacci number, which is closely related to the Golden Ratio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/477/1*tN1bXYECgd-FJ91I5Pr0QA.jpeg" /><figcaption>Fibonacci Numbers in Petals</figcaption></figure><h4>Golden Ratio in Architecture:</h4><p>The Golden Ratio is believed to have influenced the design of the Great Pyramid of Giza, one of the most iconic structures in history</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*idLIv8XlaRIUz0P1Iv1ehA.jpeg" /><figcaption>Pyramid</figcaption></figure><p>The design of the Taj Mahal incorporates the Golden Ratio in its overall proportions. The ratio of the width of the central dome to the height of the entire structure, including the dome, closely approximates the Golden Ratio.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*UeNvJWvECh-RAD1lM9M7uw.jpeg" /><figcaption>Taj Mahal</figcaption></figure><h4>Golden Ratio in Mona Lisa Painting:</h4><p>Leonardo da Vinci, who was fascinated by the Golden Ratio, is believed to have used it in the proportions of the Mona Lisa’s face. The placement of key facial features, such as the eyes, nose, and mouth, also aligns with the Golden Ratio, enhancing the natural beauty and symmetry of her face</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*-yh-nhMS_lpAdabQCQo8ew.jpeg" /><figcaption>Mona Lisa Painting</figcaption></figure><h4>Golden Ratio in Human Anatomy:</h4><p>The Golden Ratio is frequently observed in the proportions of the human face. For example, the ratio of the length of the face to the width, the distance between the eyes to the width of the mouth, and the length from the forehead to the chin often approximate the Golden Ratio (1.618)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*KGuZbYtiLkEBjyg1_q6uiw.png" /></figure><p><strong>Faces that closely follow these proportions are often perceived as more attractive.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/923/1*pq4ap3a5yiXwfWUbMdyeCw.png" /></figure><h4>Golden Ratio in Galaxy:</h4><p>The Milky Way Galaxy is a spiral galaxy, and its spiral arms follow a logarithmic spiral pattern. This pattern is mathematically related to the Golden Ratio</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/850/1*5hF1p3mLN5v9XnHvrUlMXg.png" /><figcaption>Milky Way Galaxy</figcaption></figure><h4>Conclusion:</h4><p>The Golden Ratio shows how math, nature, and art are connected. It appears everywhere, from the shape of galaxies and flower petals to famous architectures and paintings. This special ratio <strong>helps us understand why certain things look balanced and beautiful</strong>. It’s a timeless concept that continues to inspire and influence design and creativity, reminding us of the natural patterns that shape our world.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7747aa8670c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding 2’s Complement: The Key to Efficient Binary Arithmetic]]></title>
            <link>https://medium.com/@yashvj2222/understanding-2s-complement-the-key-to-efficient-binary-arithmetic-a24cfcb9242a?source=rss-7a798b411dfe------2</link>
            <guid isPermaLink="false">https://medium.com/p/a24cfcb9242a</guid>
            <dc:creator><![CDATA[Yash Jadhav]]></dc:creator>
            <pubDate>Fri, 16 Aug 2024 12:23:38 GMT</pubDate>
            <atom:updated>2024-08-16T12:24:17.876Z</atom:updated>
            <content:encoded><![CDATA[<p>Binary arithmetic is fundamental to digital computation, and one of the most important concepts in this domain is the 2’s complement. This technique simplifies that how computers represent and process signed integers. In this blog, we’ll unravel the concept of 2’s complement, explore its significance in binary arithmetic, and demonstrate how it forms the backbone of modern computing systems.</p><h4>Binary Numbers:</h4><p>Computers typically use the binary system internally, because they know two states: <strong>On</strong> and <strong>Off</strong>. This can be represented perfectly in the binary system (0= Off, 1= On)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OVltnpah2fKSqJS86utgCA.png" /></figure><p>A representation of decimal numbers 0 to 7 in binary would look like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/817/1*MuKTEYZuz1uVFgFbdmqdSg.png" /></figure><p>Some representation of decimal numbers are as:</p><p>8 4 2 1 <br>0 0 1 0 = 0 + 0 + 2 + 0 = 2</p><p>8 4 2 1 <br>0 1 0 1 = 0 + 4 + 0 + 1 = 5</p><h4>Negative Integers:</h4><p>In Binary Number System , first (most left hand side bit) is 0 for positive integers and for negative integers is flipped(turned to 1). By this rule we can conclude following approach to find binary representation of negative Integers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*-m9LyDiqc6is6ivMKs4-7w.png" /></figure><p>So by above consideration , we can conclude that there is a creation of 0 (positive zero) and -0 (negative zero) as two different numbers which results in wrong results.</p><p>So lets take <strong>one example</strong> (even though we already know the answer will be wrong by using above binary representation) :</p><p>2 + (-2) : <br>2 in binary equals to 0010 and -2 by above theory would be 1010.</p><p>if we add both binary numbers as :</p><p>0 0 1 0 <br>1 0 1 0 <br>1 1 0 0 = result</p><p>So 1100 in decimal is equal to 12 which is <strong><em>wrong result</em></strong> of our example.</p><p>To avoid above problem we can use 2 methods which are 1’s Complement and 2’s Complement. Let’s see which one is better to use.</p><h4><strong>1’s Complement:</strong></h4><p>Flipping all the bits in a binary sequence <strong>(turning 1’s to 0’s and 0s to 1s)</strong><br>is the basic rule of 1’s Complement. By using this rule we can make following binary representation of decimal numbers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*43OhLtkQsYNxu_f80z3Agw.png" /><figcaption>1’s Complement</figcaption></figure><p>So, for <strong>example</strong> if we take decimal 3, it’s binary value would be 0011 and -3 would be 1100. The addition of these two binaries is 1111. Applying the flip logic of the One’s Complement, 1111 is the opposite of 0000, which is decimal 0, so 1111 would be -0 again resulting in a zero and minus zero which we want to avoid.</p><p>So 1’s Complement also fails to solve that problem.</p><h4>2’s Complement:</h4><p>2’s Complement works very similar to the One’s Complement by flipping bits, but it adds 0001 to the binary representation of the negative number after flipping the values and carries in the left hand side are ignored and “thrown away”.</p><p>So by adding 0001 to binary of negative decimals, our binary number representation from -7 to -0 will shift downward by one place and the vacant place at top of the decimal will take by decimal -8 and the problem of creation of 0 and -0 will solve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*HZQZipD7Zu7GDVeieMLgfw.png" /><figcaption>2’s Complement</figcaption></figure><p><strong>For example</strong> for decimal 3, which in binary is 0011. Now by 2’s Complement rule we get the negative value binary representation as 1101. <br>Let’s add those two binary numbers and see the result will come true.</p><p>0 0 1 1 = 3<br>1 1 0 1 = -3<br>0 0 0 0 = 0</p><p>And you can see <strong>we get our expected output as 0</strong> as carries in the left hand side are ignored and “thrown away”.</p><h4>Additional Benefit of 2’s Complement:</h4><p>In 2’s complement, <strong>most</strong> <strong>left hand side bit is negative of 2³</strong> and remaining are positive 2² to 2⁰.</p><p>We can find all binary number representation of negative integers by using above rule. Some of them are shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CggO979LJm_LnhmqC4RIYg.png" /></figure><h4>Conclusion:</h4><p>Understanding 2’s complement is crucial for anyone delving into the world of binary arithmetic and digital systems. While 1’s complement offers a way to represent negative numbers in binary, it comes with significant drawbacks, particularly the issue of having two representations for zero and the need for correction during addition.</p><p>2’s complement, on the other hand, simplifies the process by providing a more elegant solution. With a single representation for zero, seamless addition and subtraction, and easier hardware implementation, it has become the standard for representing signed integers in modern computing.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a24cfcb9242a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>