<?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 Bishal  on Medium]]></title>
        <description><![CDATA[Stories by Bishal  on Medium]]></description>
        <link>https://medium.com/@bishal.221419?source=rss-874b62525e60------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*KXFhH9JH97I4UiZp</url>
            <title>Stories by Bishal  on Medium</title>
            <link>https://medium.com/@bishal.221419?source=rss-874b62525e60------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 02 Dec 2026 07:48:34 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@bishal.221419/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[Getting started with n8n with an interesting project]]></title>
            <link>https://medium.com/intern-elite/getting-started-with-n8n-with-an-interesting-project-df9cf6d5ca6d?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/df9cf6d5ca6d</guid>
            <category><![CDATA[n8n-workflow-automation]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[n8n-workflow]]></category>
            <category><![CDATA[n8n]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Sun, 22 Jun 2025 17:17:26 GMT</pubDate>
            <atom:updated>2025-06-22T17:21:39.701Z</atom:updated>
            <content:encoded><![CDATA[<p>We’ll learn what n8n is and its basics. We’ll also create a workflow that sends us a motivational quote.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAUiped33t0go-Xa0agRAg.png" /></figure><p><strong>So what’s n8n anyway?</strong></p><p>n8n is a powerful, open-source workflow automation tool that lets you visually connect services (APIs, apps, databases, etc.) to automate tasks — without much code. Let’s break down its fundamentals and build a beginner-friendly, essential project that introduces you to its core concepts, components, and intuition.</p><p><strong>Key Concepts of n8n</strong></p><p><strong>Node: </strong>A step in a workflow — e.g., get data from an API, send an email, run a function</p><p><strong>Workflow: </strong>A collection of nodes connected in sequence or branches</p><p><strong>Trigger: </strong>A node that starts the workflow (e.g., time-based, webhook, email)</p><p><strong>Execution: </strong>A run of the workflow (manual or automated)</p><p><strong>Data Flow: </strong>The passing of data (usually JSON) between nodes</p><p><strong>Expression: </strong>{{ }} syntax to dynamically use previous data inside nodes</p><p><strong>Run Once / Active: </strong>Run manually to test (Run Once) or make live (Active)</p><p><strong>The First Project: Daily Motivational Quote to Email</strong></p><p>So we’ll try and make a workflow that is capable of fetching a motivational quote from an API(zenquotes) and sending it to our mail whenever we trigger the workflow.</p><p><strong>Step 1: Trigger — Manual Trigger</strong></p><p>We’ll use a manual trigger for now, which quickly executes the workflow whenever we request it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/227/1*DQz69h9pk_H5l4g0dPzYNA.png" /><figcaption>Manual Trigger Node</figcaption></figure><p><strong>Step 2: Action — HTTP Request</strong></p><p>We’ll use an HTTP request to fetch the data provided by the API. Our API in this case is the ‘zenquote’ API, which provides a quote along with its author. This step generally requires setting parameters that can make this step much more annoying, but for our beginner-friendly project, we can get this node set up quite easily.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/507/1*mvvn5MT4z9kxvppl9uMVrg.png" /><figcaption>workflow upto this point</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/762/1*c0kfzfl8QZFNG5S4FmwVxg.png" /><figcaption>parameters for HTTP Request node</figcaption></figure><p><strong>Step 3: Set Node (optional but good practice)</strong></p><p>This node is used to clean/shape data for easier use.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/503/1*Z0XyTFKcEi-QYTJCYwHRAA.png" /><figcaption>data fetched from HTTP Request before clean/shape</figcaption></figure><p>We see that the data fetched from the HTTP Request is not formatted as nicely as we would like it to be. So let’s replace ‘q’ with ‘quote’ and ‘a’ with ‘author’.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rzqnYxU0Q7uobOF3OVH6uw.png" /></figure><p>And as we see from the above screenshot, we changed the field’s name for easier use. The output is now easier to read and more intuitive to discern.</p><p><strong>Step 4: Action — Send Email</strong></p><p>And here we use the Send Email node to send an email to ourselves with the motivational quote.</p><p><strong>Beware</strong>: We need to create a credential first to use this node. So be sure to allow 2-step authentication in your Gmail account using <a href="https://myaccount.google.com/security">https://myaccount.google.com/security</a>. Now use <a href="https://myaccount.google.com/apppasswords">https://myaccount.google.com/apppasswords</a> to create a new App Password and be sure to get the 16-character password that Gmail provides.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/755/1*E-aB3aXDeQucdbDHi2LQ9A.png" /><figcaption>parameters of Send Email node</figcaption></figure><p>Be sure to feel the fields shown above for this node with appropriate information.</p><p>And the final workflow should look something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8NvJTz1Ok-22DphdBRDPLA.png" /><figcaption>complete worflow for this project</figcaption></figure><p>And just like that, we were able to automate a workflow that provides us with a motivational quote via email.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*uawJRvCEhNun8p2dRQOvsg.png" /><figcaption>the mail I recieved from the above automation workflow</figcaption></figure><p>Just from this simple project, we have covered all the core fundamentals of n8n:</p><ul><li>Using <strong>Triggers</strong></li><li>Making <strong>API calls</strong></li><li>Processing <strong>JSON data</strong></li><li>Using <strong>expressions</strong> ({{ }})</li><li>Sending an <strong>automated email</strong></li></ul><p><strong>What You Can Do Next</strong></p><p>Here are a few cool upgrades you can try when you’re ready:</p><ol><li>Replace Manual Trigger with Cron: Switch to a Cron node to send the quote every morning</li><li>Add Filtering or Weekday Logic: Only send on weekdays (using a Function node or IF node)</li><li>Send to Telegram, Discord, or Notion: Replace the email with a Telegram bot message or a Notion page insert</li><li>Log Quotes to Google Sheets: Add a Google Sheets node after the Set node to store all sent quotes</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=df9cf6d5ca6d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/getting-started-with-n8n-with-an-interesting-project-df9cf6d5ca6d">Getting started with n8n with an interesting project</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Working with APIs in Python: A Beginner’s Guide]]></title>
            <link>https://medium.com/intern-elite/working-with-apis-in-python-a-beginners-guide-dd614e49e186?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/dd614e49e186</guid>
            <category><![CDATA[api]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Thu, 05 Jun 2025 16:32:49 GMT</pubDate>
            <atom:updated>2025-06-06T01:23:48.804Z</atom:updated>
            <content:encoded><![CDATA[<p>Whether you’re building an app, analyzing real-time weather data, or just pulling in stock prices for your side project, APIs (Application Programming Interfaces) are a powerful tool in any Python developer’s toolbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PwOsSPBut0IsqIVsqJlelQ.jpeg" /><figcaption>courtesy: Akamai</figcaption></figure><p>In this blog post, we’ll walk you through what APIs are, how to work with them using Python, and some hands-on code examples to get you started.</p><p><strong>What Is an API?</strong></p><p>An API is like a waiter in a restaurant. You (the client) ask the waiter (API) for something (like weather data), and the waiter brings it back from the kitchen (the server). You don’t need to know how the kitchen works — just how to ask.</p><p>APIs allow different software systems to communicate. In the world of Python, we often use web APIs to fetch data over the internet, such as COVID-19 statistics, news headlines, or pollution levels.</p><p><strong>Prerequisite</strong></p><p>Before you begin, ensure that you have the Python requests package installed.</p><p>You can use the following command to install it:</p><pre>pip install requests</pre><p>The requests library is the most popular way to make HTTP requests in Python. It’s beginner-friendly and well-documented.</p><p><strong>A basic API call</strong></p><p>Let’s try a real API — the OpenWeatherMap API. First, sign up and get your free API key.</p><pre>import requests<br><br>api_key = &quot;your_api_key&quot;<br>city = &quot;Kathmandu&quot;<br>url = f&quot;http://api.openweathermap.org/data/2.5/weather?q={city}&amp;appid={api_key}&amp;units=metric&quot;<br><br>response = requests.get(url)<br>data = response.json()<br><br>if response.status_code == 200:<br>    print(f&quot;City: {data[&#39;name&#39;]}&quot;)<br>    print(f&quot;Temperature: {data[&#39;main&#39;][&#39;temp&#39;]}°C&quot;)<br>    print(f&quot;Weather: {data[&#39;weather&#39;][0][&#39;description&#39;]}&quot;)<br>else:<br>    print(&quot;Failed to retrieve data:&quot;, data.get(&quot;message&quot;, &quot;Unknown error&quot;))<br><br># Output<br><br>City: Kathmandu<br>Temperature: 27.3°C<br>Weather: clear sky</pre><p><strong>Investigating the response</strong></p><p>APIs typically return data in JSON (JavaScript Object Notation) format. Python’s .json() method converts it into dictionaries and lists you can work with easily.</p><p><strong>Error Handling</strong></p><p>Always check the response status:</p><pre>if response.status_code != 200:<br>    print(&quot;Something went wrong:&quot;, response.text)</pre><p>Some common status codes:</p><p>-&gt; 200: OK</p><p>-&gt; 401: Unauthorized (maybe your API key is wrong)</p><p>-&gt; 404: Not Found (check the endpoint)</p><p>-&gt; 500: Server Error (problem on their side)</p><p><strong>Working with Parameters</strong></p><p>Instead of putting everything in the URL, use the params argument:</p><pre>params = {<br>    &quot;q&quot;: &quot;Kathmandu&quot;,<br>    &quot;appid&quot;: api_key,<br>    &quot;units&quot;: &quot;metric&quot;<br>}<br><br>response = requests.get(&quot;http://api.openweathermap.org/data/2.5/weather&quot;, params=params)</pre><p><strong>Applications of API</strong></p><p>Here are some ideas for projects where APIs shine:</p><p>🌦 Weather dashboards (OpenWeatherMap)</p><p>📰 News summarizers (NewsAPI)</p><p>📈 Stock/crypto price trackers (Yahoo Finance API, CoinGecko)</p><p>📍 Air quality apps (OpenAQ API)</p><p>📊 COVID-19 stats visualizer (disease.sh)</p><p><strong>Best Practices when working with APIs</strong></p><ol><li>Keep your API keys secret (use .env files or environment variables).</li></ol><p>2. Read the API documentation carefully.</p><p>3. Rate limits exist — don’t flood the server with requests.</p><p>4. Use try-except blocks to handle unexpected errors.</p><p>Learning how to work with APIs opens up a world of data-driven possibilities in Python. It’s one of the fastest ways to bring your ideas to life — whether you’re building a chatbot, a dashboard, or just exploring the world through data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dd614e49e186" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/working-with-apis-in-python-a-beginners-guide-dd614e49e186">Working with APIs in Python: A Beginner’s Guide</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Step 1 in Machine Learning: Getting your data ready using scikit-learn]]></title>
            <link>https://medium.com/intern-elite/step-1-in-machine-learning-getting-your-data-ready-using-scikit-learn-5bad044748cd?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/5bad044748cd</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-processing]]></category>
            <category><![CDATA[scikit-learn]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Mon, 02 Jun 2025 17:08:02 GMT</pubDate>
            <atom:updated>2025-06-06T01:22:11.186Z</atom:updated>
            <content:encoded><![CDATA[<p>Before you train any machine learning model, you need clean, well-structured data. In this blog, we’ll look at why data preparation is the most important first step in the ML workflow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V3_xVDzlrvxvVe5_gTslbA.png" /></figure><p>Let’s quickly go over the three main steps we take to prepare the data for the Machine Learning model.</p><ol><li>Split the data into features and labels (usually ‘X’ and ‘y’)</li><li>Filling (also called imputing) or disregarding missing values</li><li>Converting non-numerical values to numerical values(also called feature encoding)</li><li><strong>Split the data into features and labels (usually ‘X’ and ‘y’)</strong></li></ol><p>We’ll be working on a car sales dataset with missing values. Here’s a snippet:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*_fQl1RGnxZ78EynWZSVJ6g.png" /></figure><p>We’ll take the ‘Make’, ‘Colour’, ‘Odometer (KM)’, and ‘Doors’ as features, and ‘Price’ will be the label we try to predict.</p><p>Hence, the features will be represented by ‘X’ and ‘y’ represents the label.</p><pre># drop all the rows with missing price<br><br>car_sales_missing = pd.read_csv(&#39;car-sales-extended-missing-data.csv&#39;)<br>car_sales_missing = car_sales_missing.dropna(subset=&#39;Price&#39;)<br>car_sales_missing.info()<br><br># Usaul separation of X and y<br><br>X = car_sales_missing.drop(&#39;Price&#39;, axis = 1)<br>y = car_sales_missing[&#39;Price&#39;]</pre><p>Note: Always make sure to split the data into train and test data before filling and transformation, since you have to prevent data leakage from occurring.</p><pre>np.random.seed(42)<br><br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)<br>X_train, X_test</pre><p><strong>2. Filling (also called imputing) or disregarding missing values</strong></p><p>We’ll use the SimpleImputer class from sklearn.impute to fill the missing values.</p><pre># Filling the missing values separately for train and test to ensure isolated data for each<br><br># Filling missing values using sklearn<br><br>from sklearn.impute import SimpleImputer<br><br># Create categorical variable imputer<br>cat_imputer = SimpleImputer(strategy = &#39;constant&#39;, fill_value = &#39;missing&#39;)<br><br># Create Door column imputer<br>door_imputer = SimpleImputer(strategy = &#39;constant&#39;, fill_value=4)<br><br># Create Odometer (KM) column imputer<br><br>num_imputer = SimpleImputer(strategy = &#39;mean&#39;)<br><br><br># Define different column features <br><br>categorical_features = [&#39;Make&#39;, &#39;Colour&#39;]<br>door_features = [&#39;Doors&#39;]<br>numerical_features = [&#39;Odometer (KM)&#39;]</pre><p>Then we use the ColumnTransformer class from sklearn.compose to create a new DataFrame with the new values filled in.</p><pre># Create an imputer (something that fills missing data)<br><br>from sklearn.compose import ColumnTransformer<br><br>imputer = ColumnTransformer([<br>  (&#39;cat_imputer&#39;, cat_imputer, categorical_features),<br>  (&#39;door_imputer&#39;, door_imputer, door_features),<br>  (&#39;num_imputer&#39;, num_imputer, numerical_features)<br>])<br><br># Fill train and test values separately<br><br>filled_X_train = imputer.fit_transform(X_train)  # fit_transform imputes the missing values from the training set and fills them simultaneously<br><br>filled_X_test = imputer.transform(X_test) # tranform takes the imputing missing values from the training set and fills the test set with them<br><br># Get our transformed data array&#39;s back into DataFrame&#39;s<br><br>car_sales_filled_train = pd.DataFrame(filled_X_train, columns = [&#39;Make&#39;, &#39;Colour&#39;, &#39;Doors&#39;, &#39;Odometer (KM)&#39;])<br><br>car_sales_filled_test = pd.DataFrame(filled_X_test, columns = [&#39;Make&#39;, &#39;Colour&#39;, &#39;Doors&#39;, &#39;Odometer (KM)&#39;])</pre><p><strong>3. Converting non-numerical values to numerical values(also called feature encoding)</strong></p><p>We’ll use the <a href="https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html">OneHotEncoder</a> class from sklearn.preprocessing to convert the categorical features into a numeric array.</p><pre># Now let&#39;s one hot encode the features with the same code as before <br><br>from sklearn.preprocessing import OneHotEncoder<br><br>categorical_features = [&#39;Make&#39;, &#39;Colour&#39;, &#39;Doors&#39;]<br>one_hot = OneHotEncoder(sparse_output=False)<br>transformer = ColumnTransformer([(&#39;one_hot&#39;, one_hot, categorical_features)], remainder=&#39;passthrough&#39;)<br><br># Fill train and test values separately<br>train_transformed = transformer.fit_transform(car_sales_filled_train) # fit and transform the training data<br>test_transformed = transformer.transform(car_sales_filled_test) # transform the test data<br><br>pd.DataFrame(train_transformed).head(), pd.DataFrame(test_transformed).head()</pre><p>The final output after filling in the missing data and feature encoding the categorical features:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/771/1*E0pRCVCN0cThNQyNrUZRyA.png" /></figure><p>Hence, we have completed the general steps to get the data ready for fitting with a model. Stay tuned to find out the thought process behind choosing the best model for you.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5bad044748cd" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/step-1-in-machine-learning-getting-your-data-ready-using-scikit-learn-5bad044748cd">Step 1 in Machine Learning: Getting your data ready using scikit-learn</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Python Methods and Specialized Data Types: collections, datetime, and array]]></title>
            <link>https://medium.com/intern-elite/python-methods-and-specialized-data-types-collections-datetime-and-array-03e9c3bc9d34?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/03e9c3bc9d34</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[modules]]></category>
            <category><![CDATA[methods]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Sun, 01 Jun 2025 16:17:30 GMT</pubDate>
            <atom:updated>2025-06-01T17:44:07.150Z</atom:updated>
            <content:encoded><![CDATA[<p>Python’s standard library includes powerful built-in methods and specialized data types that improve both code clarity and performance. This blog provides an overview of Python object methods and dives into the collections, datetime, and array modules.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*F9f3lMzldZkzGTp3Iq4TtQ.jpeg" /></figure><ol><li><em>Python Object</em> Methods<br>In Python, everything is an object, and each object has methods — functions associated with the object’s type. These methods enable manipulation and interaction with the object’s internal data.</li></ol><pre># String Methods<br><br>&quot;kathmandu&quot;.upper()        # &#39;KATHMANDU&#39;<br>&quot;kathmandu&quot;.startswith(&quot;kat&quot;)  # True<br><br># List Methods<br><br>cities = [&quot;Lalitpur&quot;, &quot;Bhaktapur&quot;]<br>cities.append(&quot;Pokhara&quot;)   # [&#39;Lalitpur&#39;, &#39;Bhaktapur&#39;, &#39;Pokhara&#39;]</pre><p>Understanding and using built-in methods effectively helps in writing concise and readable code.</p><p>2. <em>collections </em>Module<br>The collections module provides specialized container datatypes beyond the built-in dict, list, set, and tuple.</p><p>a) Counter: Counts occurrences of elements in a collection.</p><pre>from collections import Counter<br><br>elements = [&#39;air&#39;, &#39;dust&#39;, &#39;air&#39;]<br>Counter(elements)  # Counter({&#39;air&#39;: 2, &#39;dust&#39;: 1})</pre><p>b) defaultdict: A dictionary with default values for missing keys.</p><pre>from collections import defaultdict<br><br>d = defaultdict(int)<br>d[&#39;a&#39;] += 1<br>d[&#39;b&#39;]  # 0</pre><p>c) namedtuple: Creates tuple-like objects with named fields for readability.</p><pre>from collections import namedtuple<br><br>City = namedtuple(&quot;City&quot;, [&quot;name&quot;, &quot;population&quot;])<br>ktm = City(&quot;Kathmandu&quot;, 1000000)<br>ktm.name  # &#39;Kathmandu&#39;</pre><p>3. <em>datetime </em>Module</p><p>The datetime module is used for working with dates and times.</p><pre>from datetime import datetime, timedelta<br><br>now = datetime.now()<br>yesterday = now - timedelta(days=1)<br>now.strftime(&quot;%Y-%m-%d %H:%M:%S&quot;)  # Format the current time</pre><p>Common use cases include timestamping, calculating durations, and formatting or parsing date strings.</p><p>4. <em>array </em>Module</p><p>The array module provides efficient storage for numerical data using typed arrays. Unlike lists, arrays are constrained to a single data type and use less memory.</p><pre>from array import array<br><br>arr = array(&#39;i&#39;, [1, 2, 3])<br>arr.append(4)  # array(&#39;i&#39;, [1, 2, 3, 4])</pre><p>Type codes like ‘i’ (integer) and ‘f’ (float) determine the type of elements stored.</p><p>The standard Python library offers a rich set of tools that go beyond the basics. Built-in methods simplify object manipulation, while modules like collections, datetime, and array provide efficient solutions for specialized tasks such as counting, structured data handling, date-time operations, and memory-efficient numeric storage. Mastering these features not only leads to cleaner and more performant code but also builds a strong foundation for more advanced programming in Python.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=03e9c3bc9d34" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/python-methods-and-specialized-data-types-collections-datetime-and-array-03e9c3bc9d34">Python Methods and Specialized Data Types: collections, datetime, and array</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scikit-learn, the go-to library for traditional machine learning in Python]]></title>
            <link>https://medium.com/intern-elite/scikit-learn-the-go-to-library-for-traditional-machine-learning-in-python-d3e8081f5805?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/d3e8081f5805</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[scikit-learn]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Tue, 27 May 2025 17:05:15 GMT</pubDate>
            <atom:updated>2025-05-28T09:20:50.828Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s have a high-level overview of the scikit-learn workflow in 6 fundamental steps.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hLeo_YCSQ01l9Qs1sbvLXw.jpeg" /></figure><p>Whether you’re a curious beginner taking your first steps in data science or an aspiring ML engineer looking to sharpen your skills, one Python library you’ll constantly run into is Scikit-learn. It’s the backbone of countless machine learning projects — simple enough to get started with, yet powerful enough to solve real-world problems.</p><p>This blog will demonstrate some of the most useful functions of the beautiful Scikit-Learn library.</p><p>What we’re going to cover:<br>1. Getting the data ready<br>2. Choose the right estimator/algorithm for our problems<br>3. Fit the model/algorithm and use it to make predictions on our data<br>4. Evaluating a model<br>5. Improve the model<br>6. Save and load a trained model</p><ol><li><strong>Getting the data ready</strong></li></ol><p>Let’s work on a heart disease dataset that I got my hands on. Here is a snippet of it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0PzeSVL7HMmWtra7tqNklQ.png" /></figure><pre>import pandas as pd<br> <br>heart_disease = pd.read_csv(&#39;94 - heart-disease.csv&#39;)<br>heart_disease.head()</pre><p>Creating the features and the labels.</p><pre># Create X (feature matrix)<br><br>X = heart_disease.drop(&#39;target&#39;, axis = 1)<br><br># Create y (labels)<br>y = heart_disease[&#39;target&#39;]</pre><p><strong>2. Choose the right estimator/algorithm for our problems</strong></p><p>There is a lot of depth to this step, but for this primer, let&#39;s choose an appropriate algorithm without diving into the why.</p><p>We’ll be going with the RandomForestClassifier.</p><pre>from sklearn.ensemble import RandomForestClassifier<br>clf = RandomForestClassifier()<br><br># We&#39;ll keep the default hyperparameters<br><br>clf.get_params()</pre><p><strong>3. Fit the model to the training data</strong></p><p>Now this is where scikit-learn does its magic. The following code is able to incorporate the complicated machine learning algorithms with our data.</p><pre>from sklearn.model_selection import train_test_split<br><br># splitting the data into training and testing data<br>X_train, X_test, y_train, y_test = train_test_split(X, y, test_size = 0.2)<br><br># fitting the data<br>clf.fit(X_train, y_train)<br><br># predicting the output<br>y_preds = clf.predict(X_test)</pre><p><strong>4. Evaluate the model on the training data and test data</strong></p><p>Now let’s see how we can evaluate the model’s performance.</p><pre>clf.score(X_train, y_train), clf.score(X_test, y_test)<br><br># Output =&gt; (1.0, 0.819672131147541)</pre><p>The interpretation of this score is a doozy in and of itself. So let’s leave that for later. For now, let’s just wonder ourselves, is this a good score?</p><p><strong>5. Improve the model</strong></p><p>If you’re dissatisfied with your model’s performance, you can tinker with some parameters. Let’s see some effects that changing the n_estimators value has on the score of the model.</p><pre># Try different amount of n_estimators<br><br>import numpy as np<br>np.random.seed(42)<br><br>for i in range(10,110,10):<br>    print(f&#39;Trying model with {i} estimators...&#39;)<br>    clf = RandomForestClassifier(n_estimators=i).fit(X_train, y_train)<br>    print(f&#39;Model accuracy on test set: {clf.score(X_test, y_test)*100:.2f}%&#39;) <br>    print(&#39;&#39;)<br><br># Output:<br><br>Trying model with 10 estimators...<br>Model accuracy on test set: 77.05%<br><br>Trying model with 20 estimators...<br>Model accuracy on test set: 81.97%<br><br>Trying model with 30 estimators...<br>Model accuracy on test set: 85.25%<br><br>Trying model with 40 estimators...<br>Model accuracy on test set: 83.61%<br><br>Trying model with 50 estimators...<br>Model accuracy on test set: 81.97%<br><br>Trying model with 60 estimators...<br>Model accuracy on test set: 83.61%<br><br>Trying model with 70 estimators...<br>Model accuracy on test set: 78.69%<br><br>Trying model with 80 estimators...<br>Model accuracy on test set: 83.61%<br><br>Trying model with 90 estimators...<br>...<br><br>Trying model with 100 estimators...<br>Model accuracy on test set: 81.97%</pre><p>As we see, different numbers of estimators produce different scores. And n_estimators is only one of the many parameters that you can experiment with.</p><p><strong>6. Save the model and load it</strong></p><p>And of course, you can save your estimator/model/classifier for future use. Also, you can load an estimator for immediate use.</p><pre>loaded_model = pickle.load(open(&#39;random_forest_model_1.pkl&#39;, &#39;rb&#39;))<br>loaded_model.score(X_test, y_test)</pre><p>And just like that, we have gone over the general overview of the scikit-learn workflow. Of course, we only scratched the surface. We’ll go into the details of each step in the following days. For now, let’s just appreciate how easy the scikit-learn library made it for us to create a machine learning model for our unique data. Thank you, scikit-learn!!!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d3e8081f5805" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/scikit-learn-the-go-to-library-for-traditional-machine-learning-in-python-d3e8081f5805">Scikit-learn, the go-to library for traditional machine learning in Python</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Error Handling in Python]]></title>
            <link>https://medium.com/intern-elite/error-handling-in-python-0d5ccdb0a817?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/0d5ccdb0a817</guid>
            <category><![CDATA[error-handling]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Mon, 26 May 2025 11:02:27 GMT</pubDate>
            <atom:updated>2025-05-26T13:11:19.134Z</atom:updated>
            <content:encoded><![CDATA[<p>Different exceptions in Python and how to deal with them…</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9KxVH6OVQRtHZ7bBxgKPmQ.jpeg" /><figcaption>courtesy: realpython.com</figcaption></figure><p>First, let’s start by learning what exceptions are in Python. In Python, all exceptions must be instances of a class derived from BaseException. In a try statement with an except clause that mentions a particular class, it also handles any exception classes derived from that class (but not exception classes from which it is derived). Two exception classes that are not related via subclassing are never equivalent, even if they have the same name.</p><p>Some of the different types of exceptions in Python are:</p><ol><li><strong>exception IndexError</strong></li></ol><p>Raised when a sequence subscript is out of range. (Slice indices are silently truncated to fall in the allowed range; if an index is not an integer, TypeError is raised.)</p><p>2. <strong>exception KeyError</strong></p><p>Raised when a mapping (dictionary) key is not found in the set of existing keys.</p><p>3.<strong> exception NameError</strong></p><p>Raised when a local or global name is not found. This applies only to unqualified names. The associated value is an error message that includes the name that could not be found.</p><p>The name attribute can be set using a keyword-only argument to the constructor. When set, it represents the name of the variable that was attempted to be accessed.</p><p><strong><em>Basic Error Handling: try-except</em></strong></p><p>The fundamental structure for error handling in Python is the try-except block.</p><pre>try:<br>    # Code that might raise an exception<br>    result = 10 / 0<br>except ZeroDivisionError:<br>    # Code that runs if the exception occurs<br>    print(&quot;You can&#39;t divide by zero!&quot;)</pre><p><strong><em>Handling Multiple Exceptions</em></strong></p><p>You can handle different exceptions in different ways:</p><pre>try:<br>    # Code that might raise exceptions<br>    value = int(input(&quot;Enter a number: &quot;))<br>    result = 10 / value<br>    print(&quot;Result:&quot;, result)<br>except ValueError:<br>    print(&quot;That&#39;s not a valid number!&quot;)<br>except ZeroDivisionError:<br>    print(&quot;You can&#39;t divide by zero!&quot;)</pre><p><strong><em>The else and finally Clauses</em></strong></p><p><strong>The else Clause</strong><br>The else clause runs if no exceptions were raised in the try block:</p><pre>try:<br>    print(&quot;Trying something safe&quot;)<br>except:<br>    print(&quot;This won&#39;t run unless there&#39;s an error&quot;)<br>else:<br>    print(&quot;This runs only if no exceptions occurred&quot;)</pre><p><strong>The finally Clause</strong></p><p>Code in the finally block runs no matter what — whether an exception occurred or not. This is useful for cleanup operations like closing files or database connections.</p><pre>try:<br>    file = open(&quot;example.txt&quot;, &quot;r&quot;)<br>    content = file.read()<br>    print(content)<br>except FileNotFoundError:<br>    print(&quot;File not found&quot;)<br>finally:<br>    file.close()  # This will always execute<br>    print(&quot;Cleanup complete&quot;)</pre><p><strong><em>Raising Exceptions</em></strong></p><p>You can raise exceptions explicitly using the raise statement:</p><pre>def validate_age(age):<br>    if age &lt; 0:<br>        raise ValueError(&quot;Age cannot be negative&quot;)<br>    if age &gt; 120:<br>        raise ValueError(&quot;Age seems unrealistic&quot;)<br>    return True</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0d5ccdb0a817" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/error-handling-in-python-0d5ccdb0a817">Error Handling in Python</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Matplotlib for Data Visualization]]></title>
            <link>https://medium.com/intern-elite/matplotlib-for-data-visualization-6aaf749564c5?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/6aaf749564c5</guid>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[matplotlib]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Sun, 25 May 2025 11:26:22 GMT</pubDate>
            <atom:updated>2025-05-26T04:12:33.190Z</atom:updated>
            <content:encoded><![CDATA[<p>Matplotlib is considered the natural progression after learning the pandas and numpy libraries. Let’s go over the most common plots made using matplotlib in this session.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PBW2MlYqZxZ_Pj4tSUJXtg.png" /></figure><p>Matplotlib is a comprehensive library in Python that is used to create static, animated, and interactive visualizations. It’s especially popular in data science, scientific computing, and machine learning for plotting data in various forms.</p><p>Matplotlib has two major components. They are:</p><ol><li><strong>matplotlib.pyplot</strong></li></ol><p>This is the most commonly used interface. It provides a collection of functions that make matplotlib work like MATLAB.</p><p>2. <strong>matplotlib.figure.Figure and matplotlib.axes.Axes</strong></p><ul><li><strong>Figure</strong>: The whole window or page in which everything is drawn.</li><li><strong>Axes</strong>: A part of the figure where the data is plotted (not the same as x/y axes).</li></ul><p>Numerous types of plots can be made in matplotlib, which you can use to suit your interests. Let’s go over some of the basic plots that you’ll most commonly be making using matplotlib.</p><ol><li><strong>Line Plot</strong></li></ol><p>A line plot (also called a line chart) is a type of plot that displays information as a series of data points connected by straight line segments. It’s especially useful for visualizing trends over time or ordered categories.</p><pre>import matplotlib.pyplot as plt<br><br># Sample data<br>x = [1, 2, 3, 4, 5]<br>y = [10, 12, 15, 13, 18]<br><br># Create the line plot<br>plt.plot(x, y, marker=&#39;o&#39;, color=&#39;blue&#39;, linestyle=&#39;-&#39;)<br><br># Add labels and title<br>plt.xlabel(&quot;X-axis&quot;)<br>plt.ylabel(&quot;Y-axis&quot;)<br>plt.title(&quot;Simple Line Plot&quot;)<br><br># Show grid<br>plt.grid(True)<br><br># Display the plot<br>plt.show()</pre><p>2. <strong>Bar Chart</strong></p><p>A bar chart is used to display categorical data with rectangular bars representing the value of each category. It’s great for comparing quantities across categories.</p><pre>import matplotlib.pyplot as plt<br><br># Sample data<br>categories = [&#39;A&#39;, &#39;B&#39;, &#39;C&#39;, &#39;D&#39;, &#39;E&#39;]<br>values = [5, 7, 3, 8, 6]<br><br># Create the bar chart<br>plt.bar(categories, values, color=&#39;skyblue&#39;)<br><br># Add labels and title<br>plt.xlabel(&quot;Categories&quot;)<br>plt.ylabel(&quot;Values&quot;)<br>plt.title(&quot;Simple Bar Chart&quot;)<br><br># Display the plot<br>plt.show()</pre><p>3. <strong>Histogram</strong></p><p>A histogram is used to represent the distribution of numerical data by grouping it into bins (intervals). It’s great for understanding the frequency distribution of a dataset.</p><pre>import matplotlib.pyplot as plt<br>import numpy as np<br><br># Sample data (e.g., test scores)<br>data = [55, 60, 61, 62, 65, 66, 67, 68, 69, 70, 72, 75, 78, 80, 85, 88, 90, 92, 95]<br><br># Create histogram<br>plt.hist(data, bins=5, color=&#39;steelblue&#39;, edgecolor=&#39;black&#39;)<br><br># Add labels and title<br>plt.xlabel(&quot;Score Range&quot;)<br>plt.ylabel(&quot;Frequency&quot;)<br>plt.title(&quot;Histogram of Test Scores&quot;)<br><br># Show grid for y-axis<br>plt.grid(axis=&#39;y&#39;)<br><br># Display the plot<br>plt.show()</pre><p>4. <strong>Scatter plot</strong></p><p>A scatter plot is a type of graph that shows the relationship between two different variables by plotting points on a two-dimensional plane.</p><pre>import matplotlib.pyplot as plt<br><br># Sample data: hours studied vs exam scores<br>hours_studied = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]<br>exam_scores = [50, 55, 65, 70, 75, 80, 85, 90, 95, 98]<br><br># Create scatter plot<br>plt.scatter(hours_studied, exam_scores)<br><br># Add title and axis labels<br>plt.title(&quot;Hours Studied vs Exam Scores&quot;)<br>plt.xlabel(&quot;Hours Studied&quot;)<br>plt.ylabel(&quot;Exam Score&quot;)<br><br># Show plot<br>plt.show()</pre><p>5. <strong>Pie chart</strong></p><p>A pie chart is a circular graph that shows how a whole is divided into parts. Each “slice” of the pie represents a category’s proportion of the total.</p><pre>import matplotlib.pyplot as plt<br><br># Sample data: distribution of favorite fruits<br>fruits = [&#39;Apples&#39;, &#39;Bananas&#39;, &#39;Cherries&#39;, &#39;Dates&#39;]<br>sizes = [30, 25, 25, 20]  # percentage values or counts<br><br># Create pie chart<br>plt.pie(sizes, labels=fruits, autopct=&#39;%1.1f%%&#39;, startangle=90)<br><br># Add title<br>plt.title(&quot;Favorite Fruits Distribution&quot;)<br><br># Equal aspect ratio ensures pie is circular<br>plt.axis(&#39;equal&#39;)<br><br># Show plot<br>plt.show()</pre><p>Hence, these were the most common plots in matplotlib. You should have a good grasp of these plots if you wish to master the matplotlib library.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6aaf749564c5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/matplotlib-for-data-visualization-6aaf749564c5">Matplotlib for Data Visualization</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A hands-on application of the pandas library for useful data analysis of a Netflix dataset(Part 1)]]></title>
            <link>https://medium.com/intern-elite/a-hands-on-application-of-the-pandas-library-for-useful-data-analysis-of-a-netflix-dataset-part-1-9690c2238d67?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/9690c2238d67</guid>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[netflix]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Fri, 23 May 2025 15:04:29 GMT</pubDate>
            <atom:updated>2025-05-24T05:00:17.958Z</atom:updated>
            <content:encoded><![CDATA[<p>We’ll work on one of the popular datasets on Kaggle, <a href="https://www.kaggle.com/datasets/shivamb/netflix-shows">Netflix Movies and TV Shows</a>. We will go through the most fundamental steps in data analysis and try to extract useful information.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/225/1*YHm_pSk4aTOQfMGlOB0wWw.png" /></figure><ol><li><strong>Loading and Inspecting the dataset</strong></li></ol><pre>import pandas as pd<br><br>netflix = pd.read_csv(&#39;netflix_titles.csv&#39;)<br>netflix.head()</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qADphGjrSRHJGfhsvMIH_Q.png" /><figcaption>A snippet of the dataset</figcaption></figure><p><strong>Here are some basic things you can do to inspect your data.</strong></p><p>Find the number of rows and columns of your dataset and the names of the columns, and the indices.</p><pre>netflix.shape, netflix.index, netflix.columns<br><br># Output:<br># ((8807, 12),<br># RangeIndex(start=0, stop=8807, step=1),<br># Index([&#39;show_id&#39;, &#39;type&#39;, &#39;title&#39;, &#39;director&#39;, &#39;cast&#39;, &#39;country&#39;, &#39;date_added&#39;,<br>#        &#39;release_year&#39;, &#39;rating&#39;, &#39;duration&#39;, &#39;listed_in&#39;, &#39;description&#39;],<br>#       dtype=&#39;object&#39;))</pre><p>Find the basic statistical data of the numerical columns.</p><pre>netflix.describe()<br><br># Output:<br><br>      release_year<br>count 8807.000000<br>mean 2014.180198<br>std 8.819312<br>min 1925.000000<br>25% 2013.000000<br>50% 2017.000000<br>75% 2019.000000<br>max 2021.000000</pre><p>Find the basic information of each of the columns, including the number of non-null values and their data types. I personally find this to be the most useful method for a broad data overview.</p><pre>netflix.info()<br><br># Output:<br><br>&lt;class &#39;pandas.core.frame.DataFrame&#39;&gt;<br>RangeIndex: 8807 entries, 0 to 8806<br>Data columns (total 12 columns):<br> #   Column        Non-Null Count  Dtype <br>---  ------        --------------  ----- <br> 0   show_id       8807 non-null   object<br> 1   type          8807 non-null   object<br> 2   title         8807 non-null   object<br> 3   director      6173 non-null   object<br> 4   cast          7982 non-null   object<br> 5   country       7976 non-null   object<br> 6   date_added    8797 non-null   object<br> 7   release_year  8807 non-null   int64 <br> 8   rating        8803 non-null   object<br> 9   duration      8804 non-null   object<br> 10  listed_in     8807 non-null   object<br> 11  description   8807 non-null   object<br>dtypes: int64(1), object(11)<br>memory usage: 825.8+ KB</pre><p>It’s also important to know how many of your data is null values. This allows you to know how many null values are present in each column.</p><pre>netflix.isnull().sum()<br><br># Output<br><br>show_id            0<br>type               0<br>title              0<br>director        2634<br>cast             825<br>country          831<br>date_added        10<br>release_year       0<br>rating             4<br>duration           3<br>listed_in          0<br>description        0<br>dtype: int64</pre><p>We’ll also have to check if any of the rows are duplicated.</p><pre>netflix.duplicated().sum()<br><br># Fortunately we have no duplicate rows in this dataset to have to deal with</pre><p>Another convenient thing to do is to look at how many of the values in each column are unique.</p><pre>netflix.nunique()<br><br># Output<br><br>show_id         8807<br>type               2<br>title           8807<br>director        4528<br>cast            7692<br>country          748<br>date_added      1767<br>release_year      74<br>rating            17<br>duration         220<br>listed_in        514<br>description     8775<br>dtype: int64</pre><p>One of the most useful methods for an overview of a particular column is ‘value_counts()’. This provides you with the count of each value in that column.</p><pre>netflix[&#39;country&#39;].value_counts()<br><br># Output:<br><br>country<br>United States                                    2818<br>India                                             972<br>United Kingdom                                    419<br>Japan                                             245<br>South Korea                                       199<br>                                                 ... <br>Russia, Spain                                       1<br>Croatia, Slovenia, Serbia, Montenegro               1<br>Japan, Canada                                       1<br>United States, France, South Korea, Indonesia       1<br>United Arab Emirates, Jordan                        1<br>Name: count, Length: 748, dtype: int64</pre><p>2. <strong>Data Cleaning</strong></p><p>One of the most vital things to do in data cleaning is handling the missing values.</p><p>I notice that there are a lot of director names missing. Let’s dive deeper into it and see if we can do anything about it.</p><pre>netflix[netflix[&#39;director&#39;].isnull()][&#39;type&#39;].value_counts()<br><br># Output:<br><br>type<br>TV Show    2446<br>Movie       188<br>Name: count, dtype: int64</pre><p>Most of the directors whose names are missing are for TV Shows. What might be the best way to fill the blank spaces?</p><p>Let’s fill the empty director cell with ‘Unknown’, in fact, I think it&#39;s better to go with ‘Unknown’ for all missing data in this dataset. I might change this later depending on need.</p><pre>netflix = netflix.fillna(&#39;Unknown&#39;)</pre><p>Now it&#39;s time to standardize column names. This is quite important. Not necessary here since it was already in the standard format</p><pre>netflix.columns = netflix.columns.str.strip().str.lower().str.replace(&#39; &#39;, &#39;_&#39;).str.replace(r&#39;[^\w]&#39;, &#39;&#39;, regex=True)<br>netflix.head()<br><br># =&gt; converts each column to lower form with no whitespaces with underscore for space. Also excludes any special characters.</pre><p>We covered the loading, inspecting, and data cleaning part of data analysis in this part. These two are the basic and fundamental initial steps to make the data ready to be studied in a systematic manner. The next parts will include data exploration, summary, advanced grouping, aggregation, and so on. So stay tuned for that.</p><p><strong>Note</strong>: We didn&#39;t perform any data visualizations using libraries like Matplotlib and seaborn, etc. I intend to keep this project strictly pandas only. We will incorporate them in our future data analysis projects for sure.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9690c2238d67" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/a-hands-on-application-of-the-pandas-library-for-useful-data-analysis-of-a-netflix-dataset-part-1-9690c2238d67">A hands-on application of the pandas library for useful data analysis of a Netflix dataset(Part 1)</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A deeper dive into NumPy]]></title>
            <link>https://medium.com/intern-elite/a-deeper-dive-into-numpy-cf9b64f23e1f?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/cf9b64f23e1f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[numpy]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Wed, 21 May 2025 11:12:03 GMT</pubDate>
            <atom:updated>2025-05-22T04:21:12.149Z</atom:updated>
            <content:encoded><![CDATA[<p>Let’s go further than the basic datatypes and attributes of the NumPy library. We’ll discover more things to do with NumPy arrays and find different ways to utilize them as per our need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*LcLsMsdbS9RtG7i_LCpmgA.png" /></figure><p>One of the most common things you will do in NumPy is make arrays. We can create array using various methods. For learning and for the sake of simplicity we can use the ‘random’ module. Let’s see some different ways of creating arrays in NumPy.</p><ol><li>np.random.arange()</li><li>np.random.randint()</li><li>np.random.random()</li><li>np.random.rand()</li></ol><pre># using arange<br><br>range_array = np.arange(0,20,4)<br>range_array<br><br># using randint<br><br>random_array = np.random.randint(0, 10, size = (3,3))<br>random_array<br><br># using random<br><br>random_array2 = np.random.random((2,3))<br>random_array2<br><br># using rand<br><br>random_array3 = np.random.rand(3,2)<br>random_array3</pre><p><strong>Viewing arrays and Matrices</strong></p><p>You can view various values of any given array in ways much like any normal python lists. You can use indexes and utilize the slicing method to get various parts of the array. Let me demonstrate it:</p><pre>a1 = np.random.randint(10, size = 3)<br>a2 = np.random.randint(10, size = (3,3))<br><br>a1[0] # Gives the first value of the a1 array<br>a1[:2] # Gives the first two values of the a1 array<br>a2[:2, :2] # Gives the first two colums of the first two rows for a 2-d ndarray</pre><p><strong>Manipulating array</strong></p><p>We can also perform various operations on different arrays and manipulate them as per our need.</p><p>Let’s see some of the operations we can perform on arrays for various purposes.</p><pre>a1 = np.random.rand(5)<br>a2 = np.random.rand(5)<br><br>a1+a2 # Addition<br>a1-a2 # Subtraction<br>a1*a2 # Multiplication<br>a1/a2 # Division</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cf9b64f23e1f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/a-deeper-dive-into-numpy-cf9b64f23e1f">A deeper dive into NumPy</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Object Oriented Programming(OOP) and its implementation in Python]]></title>
            <link>https://medium.com/intern-elite/object-oriented-programming-oop-and-its-implementation-in-python-e3ccf076a912?source=rss-874b62525e60------2</link>
            <guid isPermaLink="false">https://medium.com/p/e3ccf076a912</guid>
            <category><![CDATA[oop-python]]></category>
            <dc:creator><![CDATA[Bishal ]]></dc:creator>
            <pubDate>Tue, 20 May 2025 11:20:43 GMT</pubDate>
            <atom:updated>2025-05-21T01:16:17.858Z</atom:updated>
            <content:encoded><![CDATA[<p>OOP is one of the major paradigms of programming, supported by most of the major programming languages. So what exactly is OOP? And how does Python, arguably the most popular programming language today, incorporate it? Let’s take a look!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*xFK9uV-63p4ASNwDq_B1TQ.jpeg" /></figure><p><strong>What is OOP?</strong></p><p>Object-Oriented Programming (OOP) is a programming paradigm that organizes code by grouping data and behavior into reusable structures called objects.</p><p>Instead of writing code as a long list of instructions (procedural programming), OOP helps you structure your code to mimic real-world systems using classes and objects.</p><p><strong>The four pillars of OOP</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*oX4JdZkTVSfiAY2Cm98uVA.png" /></figure><ol><li>Encapsulation</li></ol><p>Encapsulation is the concept of hiding internal state and requiring all interaction to happen through an object’s methods.</p><p>2. Inheritance</p><p>Inheritance allows a class (child) to inherit attributes and methods from another class (parent).</p><p>3. Polymorphism</p><p>Polymorphism means “many forms”. It allows different classes to define methods with the same name, which can be used interchangeably.</p><p>4. Abstraction</p><p>Abstraction means hiding complex implementation details and showing only the essential features of an object.</p><p><strong>OOP in Python</strong></p><p>Object-Oriented Programming (OOP) in Python is a paradigm that allows you to model real-world entities as objects that have attributes (data) and methods (functions). It’s one of the core programming paradigms in Python, alongside procedural and functional programming.</p><p><strong>Basic Concepts of OOP in Python:</strong></p><ol><li>Class: A blueprint for creating objects.</li></ol><p>2. Object: An instance of a class.</p><p>3. Attributes: Variables that belong to an object.</p><p>4. Methods: Functions that belong to a class.</p><p>5. __init__ method: The constructor that initializes the object.</p><p>6. self: Refers to the current instance of the class.</p><pre># A simple class in Python<br><br>class Dog:<br>    def __init__(self, name, breed):<br>        self.name = name    # attribute<br>        self.breed = breed  # attribute<br><br>    def bark(self):        # method<br>        print(f&quot;{self.name} says Woof!&quot;)<br><br># Creating objects<br>dog1 = Dog(&quot;Buddy&quot;, &quot;Golden Retriever&quot;)<br>dog2 = Dog(&quot;Max&quot;, &quot;German Shepherd&quot;)<br><br>dog1.bark()  # Output: Buddy says Woof!<br>dog2.bark()  # Output: Max says Woof!</pre><p>So what should I use OOP for in Python, you ask? Let’s discuss the best places to utilize the powers of OOP.</p><ol><li>When your problem naturally involves entities with behavior and data.</li><li>For building large-scale systems (e.g., games, GUI apps, APIs).</li><li>When code reusability, modularity, and maintainability are important.</li></ol><p>Finally, here are some tips if you wish to learn OOP in python.</p><ol><li>Start by building small classes (e.g., Book, Student, Car).</li><li>Refactor procedural code into classes as practice.</li><li>Use OOP in small projects like contact books, banking systems, or game simulations</li></ol><pre># A reference code for OOP in Python with different features that might be helpful<br><br>class Pets():<br>    animals = []<br>    def __init__(self, animals):<br>        self.animals = animals<br><br>    def walk(self):<br>        for animal in self.animals:<br>            print(animal.walk())<br><br>class Cat():<br>    is_lazy = True<br><br>    def __init__(self, name, age):<br>        self.name = name<br>        self.age = age<br><br>    def walk(self):<br>        return f&#39;{self.name} is just walking around&#39;<br><br>class Simon(Cat):<br>    def sing(self, sounds):<br>        return f&#39;{sounds}&#39;<br><br>class Sally(Cat):<br>    def sing(self, sounds):<br>        return f&#39;{sounds}&#39;<br><br>#1 Add another Cat   <br> <br>class Shaun(Cat):<br>    def sing(self, sounds):<br>        return f&#39;{sounds}&#39;<br>        <br>#2 Create a list of all of the pets (create 3 cat instances from the above)<br>#my_cats = []<br><br>simon1 = Simon(&#39;simon&#39;, 1)<br>sally1 = Sally(&#39;sally&#39;, 2)<br>shaun1 = Shaun(&#39;shaun&#39;, 3)<br><br>my_cats = [simon1, sally1, shaun1]<br><br>#3 Instantiate the Pet class with all your cats use variable my_pets<br><br>my_pets = Pets(my_cats)<br><br>#4 Output all of the cats walking using the my_pets instance<br><br>my_pets.walk()</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e3ccf076a912" width="1" height="1" alt=""><hr><p><a href="https://medium.com/intern-elite/object-oriented-programming-oop-and-its-implementation-in-python-e3ccf076a912">Object Oriented Programming(OOP) and its implementation in Python</a> was originally published in <a href="https://medium.com/intern-elite">Intern Elite</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>