<?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 Atul Yadav on Medium]]></title>
        <description><![CDATA[Stories by Atul Yadav on Medium]]></description>
        <link>https://medium.com/@yatul247?source=rss-fb5f26f08a44------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*u8HStjg6XxLitjL8vHSdjQ.png</url>
            <title>Stories by Atul Yadav on Medium</title>
            <link>https://medium.com/@yatul247?source=rss-fb5f26f08a44------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 04 Dec 2026 04:16:39 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@yatul247/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[ Build a Professional Movie Recommender System Using Python, Streamlit & TMDB API]]></title>
            <link>https://medium.com/@yatul247/build-a-professional-movie-recommender-system-using-python-streamlit-tmdb-api-f16ec17758b5?source=rss-fb5f26f08a44------2</link>
            <guid isPermaLink="false">https://medium.com/p/f16ec17758b5</guid>
            <dc:creator><![CDATA[Atul Yadav]]></dc:creator>
            <pubDate>Tue, 17 Jun 2025 14:05:42 GMT</pubDate>
            <atom:updated>2025-06-17T14:06:20.884Z</atom:updated>
            <content:encoded><![CDATA[<blockquote><em>🚀 Powered by Scikit-learn · Streamlit · Pandas · Ngrok · TMDB API</em></blockquote><h3>🧠 Introduction</h3><p>If you’ve ever finished watching a movie and thought, <em>“What should I watch next?”</em> — you’re not alone. Recommender systems power the modern content experience on platforms like Netflix and Prime Video.</p><p>In this project, I set out to build a <strong>content-based movie recommender system</strong> from scratch, using <strong>Python</strong>, <strong>machine learning</strong>, and <strong>a modern web interface with Streamlit</strong>. It recommends top 5 similar movies based on your input.</p><h3>🔗 Live Demo</h3><p>👉 <strong>Try it here</strong>:<br> <a href="https://6830-2001-4858-aaaa-77-167-2f4c-64a-e012.ngrok-free.app/"><strong>https://6830-2001-4858-aaaa-77-167-2f4c-64a-e012.ngrok-free.app</strong></a></p><p>📂 <strong>GitHub Repository</strong>:<br><a href="https://github.com/atul2501/Movie_recommender_system.git"> <strong>github.com/atul2501/Movie_Recommender_System</strong></a></p><h3>💻 Tech Stack</h3><h3>🖼️ App Preview</h3><ul><li>✅ Polished introduction</li><li>✅ Tech stack badges</li><li>✅ Code walkthroughs</li><li>✅ Live demo</li><li>✅ Deployment steps</li><li>✅ Final thoughts and LinkedIn-friendly tone</li></ul><h3>🎬 Build a Professional Movie Recommender System Using Python, Streamlit &amp; TMDB API</h3><blockquote><em>🚀 Powered by Scikit-learn · Streamlit · Pandas · Ngrok· TMDB API</em></blockquote><h3>🧠 Introduction</h3><p>If you’ve ever finished watching a movie and thought, <em>“What should I watch next?”</em> — you’re not alone. Recommender systems power the modern content experience on platforms like Netflix and Prime Video.</p><p>In this project, I set out to build a <strong>content-based movie recommender system</strong> from scratch, using <strong>Python</strong>, <strong>machine learning</strong>, and <strong>a modern web interface with Streamlit</strong>. It recommends top 5 similar movies based on your input.</p><h3>🔗 Live Demo</h3><p>👉 <strong>Try it here</strong>:<br> <a href="https://6830-2001-4858-aaaa-77-167-2f4c-64a-e012.ngrok-free.app/"><strong>https://6830-2001-4858-aaaa-77-167-2f4c-64a-e012.ngrok-free.app</strong></a></p><p>📂 <strong>GitHub Repository</strong>:<br> <a href="https://github.com/atul2501/Movie_Recommender_System"><strong>github.com/atul2501/Movie_Recommender_System</strong></a></p><h3>💻 Tech Stack</h3><h3>🖼️ App Preview</h3><h3>🧪 How the Model Works</h3><p>The system uses <strong>content-based filtering</strong> using metadata such as:</p><ul><li>Cast</li><li>Crew (especially directors)</li><li>Genres</li><li>Keywords</li></ul><p>These are combined into a single text vector, vectorized using <strong>CountVectorizer</strong>, and compared using <strong>cosine similarity</strong>.</p><h3>📦 Sample Code: Recommender Logic</h3><pre>def recommend(movie):<br>    movie_index = movies[movies[&#39;title&#39;] == movie].index[0]<br>    distances = similarity[movie_index]<br>    movie_list = sorted(<br>        list(enumerate(distances)),<br>        reverse=True, key=lambda x: x[1]<br>    )[1:6]<br>    <br>    recommended_titles = []<br>    recommended_posters = []<br>    for i in movie_list:<br>        movie_id = movies.iloc[i[0]].movie_id<br>        recommended_titles.append(movies.iloc[i[0]].title)<br>        recommended_posters.append(fetch_poster(movie_id))<br>    <br>    return recommended_titles, recommended_posters</pre><h3>🎞️ Poster Fetching with TMDB API</h3><pre>import requests</pre><pre>def fetch_poster(movie_id):<br>    try:<br>        url = f&quot;https://api.themoviedb.org/3/movie/{movie_id}?api_key=YOUR_API_KEY&amp;language=en-US&quot;<br>        response = requests.get(url)<br>        data = response.json()<br>        poster_path = data.get(&#39;poster_path&#39;)<br>        return f&quot;https://image.tmdb.org/t/p/w500{poster_path}&quot; if poster_path else PLACEHOLDER_IMAGE<br>    except:<br>        return PLACEHOLDER_IMAGE</pre><blockquote><em>⚠️ Make sure to replace </em><em>YOUR_API_KEY with your TMDB API key.</em></blockquote><h3>🧑‍💻 Local Setup</h3><pre>git clone https://github.com/atul2501/Movie_Recommender_System.git<br>cd Movie_Recommender_System<br>python -m venv venv<br>venv\Scripts\activate  # or source venv/bin/activate (Mac/Linux)<br>pip install -r requirements.txt<br>streamlit run app.py</pre><p>Visit http://localhost:8501 in your browser.</p><h3>🌍 Make it Public Using ngrok</h3><p>To make it public:</p><pre>ngrok http 8501</pre><p>Copy the generated link and share your app online!</p><h3>🚀 Optional: Heroku Deployment</h3><p>You can also deploy it using Heroku by including:</p><ul><li>Procfile</li><li>setup.sh</li><li>requirements.txt</li></ul><pre>heroku create movie-recommender<br>git push heroku main</pre><h3>📁 Project Structure</h3><pre>📁 Movie_Recommender_System/<br>├── app.py               # Streamlit app<br>├── movies_dict.pkl      # Movie metadata<br>├── similarity.pkl       # Similarity matrix<br>├── requirements.txt     # Dependencies<br>├── Procfile             # For Heroku deployment<br>├── setup.sh             # Streamlit config<br>├── screenshot.png       # UI preview</pre><h3>💬 Final Thoughts</h3><p>This was a fun project that demonstrates how you can take a CSV dataset and turn it into a <strong>real-time interactive product</strong> with a clean web UI. I plan to expand this project by:</p><ul><li>Adding collaborative filtering (user-based)</li><li>Genre or rating filters</li><li>Deploying full-time on EC2 or Render</li></ul><h3>🙋 About Me</h3><p>I’m <strong>Atul Yadav</strong>, passionate about building end-to-end data-driven products using Python and open-source tools.</p><p>📫 Reach out or connect with me:</p><ul><li>GitHub: <a href="https://github.com/atul2501">@atul2501</a></li><li>LinkedIn: <a href="https://www.linkedin.com/in/atul2501">linkedin.com/in/atul2501</a></li><li>Portfolio: Coming soon…</li></ul><h3>⭐ If you liked this project:</h3><ul><li>Drop a ⭐ on <a href="https://github.com/atul2501/Movie_Recommender_System">GitHub</a></li><li>Share this article on LinkedIn</li><li>Fork and build your own version!</li></ul><p>Let me know if you’d like this turned into a <strong>Notion blog post</strong>, <strong>LinkedIn carousel</strong>, or <strong>video script</strong> for YouTube!</p><h3>🧪 How the Model Works</h3><p>The system uses <strong>content-based filtering</strong> using metadata such as:</p><ul><li>Cast</li><li>Crew (especially directors)</li><li>Genres</li><li>Keywords</li></ul><p>These are combined into a single text vector, vectorized using <strong>CountVectorizer</strong>, and compared using <strong>cosine similarity</strong>.</p><h3>📦 Sample Code: Recommender Logic</h3><pre>def recommend(movie):<br>    movie_index = movies[movies[&#39;title&#39;] == movie].index[0]<br>    distances = similarity[movie_index]<br>    movie_list = sorted(<br>        list(enumerate(distances)),<br>        reverse=True, key=lambda x: x[1]<br>    )[1:6]<br>    <br>    recommended_titles = []<br>    recommended_posters = []<br>    for i in movie_list:<br>        movie_id = movies.iloc[i[0]].movie_id<br>        recommended_titles.append(movies.iloc[i[0]].title)<br>        recommended_posters.append(fetch_poster(movie_id))<br>    <br>    return recommended_titles, recommended_posters</pre><h3>🎞️ Poster Fetching with TMDB API</h3><pre>import requests</pre><pre>def fetch_poster(movie_id):<br>    try:<br>        url = f&quot;https://api.themoviedb.org/3/movie/{movie_id}?api_key=YOUR_API_KEY&amp;language=en-US&quot;<br>        response = requests.get(url)<br>        data = response.json()<br>        poster_path = data.get(&#39;poster_path&#39;)<br>        return f&quot;https://image.tmdb.org/t/p/w500{poster_path}&quot; if poster_path else PLACEHOLDER_IMAGE<br>    except:<br>        return PLACEHOLDER_IMAGE</pre><blockquote><em>⚠️ Make sure to replace </em><em>YOUR_API_KEY with your TMDB API key.</em></blockquote><h3>🧑‍💻 Local Setup</h3><pre>git clone https://github.com/atul2501/Movie_Recommender_System.git<br>cd Movie_Recommender_System<br>python -m venv venv<br>venv\Scripts\activate  # or source venv/bin/activate (Mac/Linux)<br>pip install -r requirements.txt<br>streamlit run app.py</pre><p>Visit http://localhost:8501 in your browser.</p><h3>🌍 Make it Public Using ngrok</h3><p>To make it public:</p><pre>ngrok http 8501</pre><p>Copy the generated link and share your app online!</p><h3>🚀 Optional: Heroku Deployment</h3><p>You can also deploy it using Heroku by including:</p><ul><li>Procfile</li><li>setup.sh</li><li>requirements.txt</li></ul><pre>heroku create movie-recommender<br>git push heroku main</pre><h3>📁 Project Structure</h3><pre>📁 Movie_Recommender_System/<br>├── app.py               # Streamlit app<br>├── movies_dict.pkl      # Movie metadata<br>├── similarity.pkl       # Similarity matrix<br>├── requirements.txt     # Dependencies<br>├── Procfile             # For Heroku deployment<br>├── setup.sh             # Streamlit config<br>├── screenshot.png       # UI preview</pre><h3>💬 Final Thoughts</h3><p>This was a fun project that demonstrates how you can take a CSV dataset and turn it into a <strong>real-time interactive product</strong> with a clean web UI. I plan to expand this project by:</p><ul><li>Adding collaborative filtering (user-based)</li><li>Genre or rating filters</li><li>Deploying full-time on EC2 or Render</li></ul><h3>🙋 About Me</h3><p>I’m <strong>Atul Yadav</strong>, passionate about building end-to-end data-driven products using Python and open-source tools.</p><p>📫 Reach out or connect with me:</p><ul><li>GitHub: <a href="https://github.com/atul2501">@atul2501</a></li><li>LinkedIn: <a href="https://www.linkedin.com/in/atul2501">linkedin.com/in/atul2501</a></li><li>Portfolio: Coming soon…</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f16ec17758b5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Scraping Stock Market Data from Yahoo Finance using Python (Step-by-Step)]]></title>
            <link>https://medium.com/@yatul247/scraping-stock-market-data-from-yahoo-finance-using-python-step-by-step-2ff535ea498e?source=rss-fb5f26f08a44------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ff535ea498e</guid>
            <category><![CDATA[yahoo-finance]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-scraping]]></category>
            <category><![CDATA[finance]]></category>
            <dc:creator><![CDATA[Atul Yadav]]></dc:creator>
            <pubDate>Mon, 07 Apr 2025 19:06:15 GMT</pubDate>
            <atom:updated>2025-04-07T19:06:15.577Z</atom:updated>
            <content:encoded><![CDATA[<p>If you’re into finance or data science, you’ve likely needed stock price data at some point. Thankfully, <strong>Yahoo Finance</strong> offers a goldmine of information — and with a little bit of Python, you can automate the entire process.</p><p>In this tutorial, I’ll show you how I built a stock scraping tool using Python that fetches <strong>live stock prices</strong>, <strong>financial metrics</strong>, and <strong>summary data</strong> from Yahoo Finance.<br> This is part of my GitHub repo: 👉 <a href="https://github.com/atul2501/Yahoo-Finance-Stocks">Yahoo-Finance-Stocks</a></p><h3>💡 Why Scrape Yahoo Finance?</h3><p>Yahoo Finance is one of the most reliable and free platforms for stock data. It’s great for:</p><ul><li>📊 Market research</li><li>🤖 Building ML models for trading</li><li>📉 Historical price tracking</li><li>📈 Portfolio monitoring</li></ul><h3>🧰 Tools Used</h3><ul><li><strong>Python</strong></li><li><strong>BeautifulSoup</strong> — for parsing HTML</li><li><strong>Requests</strong> — to fetch page content</li><li><strong>Pandas</strong> — for data storage and export</li></ul><h3>🛠️ Step-by-Step Guide</h3><h3>1. Install Required Libraries</h3><pre>pip install requests beautifulsoup4 pandas</pre><h3>2. Import the Libraries</h3><pre>import requests<br>from bs4 import BeautifulSoup<br>import pandas as pd</pre><h3>3. Define the Stock Ticker and URL</h3><pre>ticker = &quot;AAPL&quot;<br>url = f&quot;https://finance.yahoo.com/quote/{ticker}&quot;<br>headers = {&#39;User-Agent&#39;: &#39;Mozilla/5.0&#39;}</pre><h3>4. Send the Request and Parse the HTML</h3><pre>response = requests.get(url, headers=headers)<br>soup = BeautifulSoup(response.text, &quot;html.parser&quot;)</pre><h3>5. Extract Key Financial Data</h3><p>Here’s how to get the current stock price:</p><pre>price = soup.find(&quot;fin-streamer&quot;, {&quot;data-field&quot;: &quot;regularMarketPrice&quot;}).text<br>print(f&quot;{ticker} Price: ${price}&quot;)</pre><p>You can also scrape other fields like:</p><ul><li>Market Cap</li><li>PE Ratio</li><li>Previous Close</li><li>Day’s Range</li><li>52-Week Range</li></ul><p>(Your GitHub repo has functions for this.)</p><h3>6. Export the Data to CSV</h3><pre>data = {<br>    &quot;Ticker&quot;: ticker,<br>    &quot;Price&quot;: price,<br>    &quot;Market Cap&quot;: market_cap,<br>    &quot;PE Ratio&quot;: pe_ratio,<br>    ...<br>}</pre><pre>df = pd.DataFrame([data])<br>df.to_csv(&quot;stock_data.csv&quot;, index=False)</pre><h3>📁 Output</h3><p>The script outputs a clean CSV with all the scraped stock data, ready for analysis or dashboard integration.</p><h3>🔗 GitHub Repo</h3><p>👉 Check out the full code on GitHub:<br> <a href="https://github.com/atul2501/Yahoo-Finance-Stocks">https://github.com/atul2501/Yahoo-Finance-Stocks</a></p><h3>🔮 Future Enhancements</h3><ul><li>Scrape multiple tickers at once</li><li>Automate daily updates</li><li>Add historical price charts</li><li>Integrate with Plotly or Streamlit for a dashboard</li></ul><h3>👨‍💻 About Me</h3><p>I’m Atul Yadav — I love building data tools and scrapers that solve real-world problems.<br> Check out more on my GitHub: <a href="https://github.com/atul2501">github.com/atul2501</a></p><p>Let’s connect on <a href="https://www.linkedin.com/in/atul-yadav-112063294/">LinkedIn</a></p><p>Want a shorter LinkedIn post version too? I can help you with that next!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ff535ea498e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[ Web Scraping Real Estate Listings from 99acres (Thane) using Python & Selenium]]></title>
            <link>https://medium.com/@yatul247/web-scraping-real-estate-listings-from-99acres-thane-using-python-selenium-c4e30dbc43dd?source=rss-fb5f26f08a44------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4e30dbc43dd</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[automation]]></category>
            <category><![CDATA[real-estate]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Atul Yadav]]></dc:creator>
            <pubDate>Mon, 07 Apr 2025 18:55:10 GMT</pubDate>
            <atom:updated>2025-04-07T18:55:10.129Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we’ll walk through a step-by-step guide to <strong>scrape real estate listings from 99acres.com</strong> for properties in <strong>Thane</strong> using <strong>Python, Selenium, and Pandas</strong>. This is a beginner-friendly project with real-world use.</p><p>🔗 <strong>GitHub Repo</strong>: <a href="https://github.com/atul2501/Project-02---Real-Estate-Details">https://github.com/atul2501/Project-02-Real-Estate-Details</a></p><h3>📌 What You’ll Learn</h3><ul><li>Using <strong>Selenium</strong> to control Chrome browser</li><li>Navigating multiple pages and avoiding bot detection</li><li>Extracting structured data (like price, area, furnishing, etc.)</li><li>Saving the result into a <strong>CSV file</strong></li></ul><h3>🧰 Step 1: Install Required Libraries</h3><p>Before we begin, install the necessary packages:</p><pre>pip install selenium pandas</pre><p>You’ll also need to download <strong>ChromeDriver</strong> that matches your Chrome browser version:<br> 🔗 <a href="https://sites.google.com/chromium.org/driver/">https://sites.google.com/chromium.org/driver/</a></p><h3>🛠️ Step 2: Set Up Selenium with Stealth Mode</h3><p>Use a custom user-agent and options to avoid getting blocked:</p><pre>from selenium import webdriver<br>from selenium.webdriver.chrome.options import Options</pre><pre>chrome_options = Options()<br>chrome_options.add_argument(&quot;--disable-http2&quot;)<br>chrome_options.add_argument(&quot;--incognito&quot;)<br>chrome_options.add_argument(&quot;--disable-blink-features=AutomationControlled&quot;)<br>chrome_options.add_argument(&quot;--ignore-certificate-errors&quot;)<br>chrome_options.add_argument(&quot;--enable-features=NetworkServiceInProcess&quot;)<br>chrome_options.add_argument(&quot;--disable-features=NetworkService&quot;)<br>chrome_options.add_argument(<br>    &quot;user-agent=Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36&quot;<br>)</pre><pre>driver = webdriver.Chrome(options=chrome_options)</pre><h3>🌐 Step 3: Define the Target URL</h3><p>We’ll scrape <strong>Thane</strong> properties from 99acres:</p><pre>url = &quot;https://www.99acres.com/search/property/buy/thane?search_type=QS&amp;search_location=SH&amp;lstAcn=SEARCH&amp;lstAcnId=...&quot;<br>driver.get(url)</pre><h3>🔁 Step 4: Scrape Data from Multiple Pages</h3><p>We loop through available pages and extract key property information:</p><pre>property_data = []</pre><pre>for page in range(1, 3):  # Increase range for more pages<br>    print(f&quot;Scraping page {page}...&quot;)<br>    cards = driver.find_elements_by_css_selector(&quot;.srpTuple__tupleTable&quot;)<br>    <br>    for card in cards:<br>        try:<br>            title = card.find_element_by_css_selector(&quot;.srpTuple__propertyTitle&quot;).text<br>            price = card.find_element_by_css_selector(&quot;.srpTuple__spacer16 .srpTuple__midGridTitle&quot;).text<br>            location = card.find_element_by_css_selector(&quot;.srpTuple__tupleAddress&quot;).text<br>            area = card.find_element_by_css_selector(&quot;.srpTuple__area&quot;).text<br>            prop_type = card.find_element_by_css_selector(&quot;.srpTuple__propType&quot;).text<br>            posted = card.find_element_by_css_selector(&quot;.srpTuple__postedBy&quot;).text<br>            <br>            property_data.append({<br>                &quot;Title&quot;: title,<br>                &quot;Price&quot;: price,<br>                &quot;Location&quot;: location,<br>                &quot;Area&quot;: area,<br>                &quot;Type&quot;: prop_type,<br>                &quot;Posted&quot;: posted<br>            })<br>        except Exception as e:<br>            print(&quot;Error:&quot;, e)</pre><pre>    # Next Page<br>    next_btn = driver.find_element_by_css_selector(&quot;.list_header_semiBold.pagination__rightArrow&quot;)<br>    next_btn.click()<br>    time.sleep(3)</pre><h3>📄 Step 5: Save to CSV</h3><p>We’ll save the collected data to a CSV file using pandas:</p><pre>import pandas as pd</pre><pre>df = pd.DataFrame(property_data)<br>df.to_csv(&quot;thane_properties.csv&quot;, index=False)<br>print(&quot;✅ Data saved to thane_properties.csv&quot;)</pre><h3>📊 Sample Output</h3><p>Title Price Location Area Type Posted 2 BHK in Thane W ₹95 Lac Thane West 980 sqft Flat 1 day ago</p><h3>📌 Conclusion</h3><p>We just built a functional <strong>real estate web scraper</strong> for 99acres in Thane! You can now analyze trends, compare pricing, or extend it for other cities.</p><h3>🔗 Project Repository</h3><p>Check out the full code and notebook here:<br> 👉 <a href="https://github.com/atul2501/Project-02-Real-Estate-Details.git">https://github.com/atul2501/Project-02-Real-Estate-Details</a></p><h3>🙋‍♂️ About Me</h3><p>I love building real-world automation tools with Python.<br> <strong>Made with ❤️ by </strong><a href="https://github.com/atul2501"><strong>Atul</strong></a></p><p>Let’s connect on <a href="https://www.linkedin.com/in/atul-yadav-112063294/">LinkedIn</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4e30dbc43dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scraping Movie Data Using the TMDB API]]></title>
            <link>https://medium.com/@yatul247/scraping-movie-data-using-the-tmdb-api-d0cf8d9ecd45?source=rss-fb5f26f08a44------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0cf8d9ecd45</guid>
            <category><![CDATA[data-scraping]]></category>
            <dc:creator><![CDATA[Atul Yadav]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 13:51:35 GMT</pubDate>
            <atom:updated>2025-03-31T13:51:35.420Z</atom:updated>
            <content:encoded><![CDATA[<h3>Scraping Movie Data Using the TMDB API with Python</h3><p>In this post, I will explain a Python script that uses <strong>The Movie Database (TMDB) API</strong> to fetch and organize information about popular movies. The script makes use of libraries like <strong>requests</strong> for API calls and <strong>Pandas</strong> for data processing. If you’re looking to work with movie data or build a similar project, this post should serve as a helpful guide.</p><h3>Prerequisites</h3><p>Before we dive into the code, ensure you have the following libraries installed:</p><pre>pip install requests pandas</pre><p>Additionally, you’ll need an API key from <a href="https://www.themoviedb.org/">The Movie Database API</a>. In this example, the API key is hardcoded for simplicity, but in a production environment, it’s recommended to store sensitive information like this securely (e.g., using environment variables).</p><h3>The Code Breakdown</h3><h4>1. Setting Up the API Key and Final DataFrame</h4><pre>api_key=&#39;c38986c04eeba139e93aae724f375443&#39;<br>final=pd.DataFrame()</pre><p>The script begins by defining the <strong>API key</strong>, which is required to access the TMDB API. It then creates an empty Pandas DataFrame called final. This will store the aggregated movie data over time as we loop through different pages of the API response.</p><h4>2. Making API Calls to Fetch Movie Data</h4><pre>for j in range(1,501):<br>    response=requests.get(f&#39;https://api.themoviedb.org/3/movie/popular?api_key={api_key}&amp;language=en-US&amp;page={format(j)}&#39;).json()</pre><p>Here, we have a loop that runs from <strong>page 1 to 500</strong> (note: you can adjust this range depending on the amount of data you want). Each page of the API response contains a list of <strong>popular movies</strong>. The requests.get() function fetches the data, and .json() converts the response into a Python dictionary format.</p><h4>3. Initializing Lists for Each Data Field</h4><pre>popularity=[]<br>vote_count=[]<br>original_language=[]<br>title=[]<br>vote_average=[]<br>release_date=[]<br>overview=[]</pre><p>Inside the loop, we initialize <strong>empty lists</strong> to store specific attributes of the movies. These attributes are:</p><ul><li>title: The title of the movie.</li><li>popularity: A score indicating how popular the movie is.</li><li>vote_count: The number of votes the movie has received.</li><li>original_language: The original language of the movie.</li><li>vote_average: The average rating given to the movie.</li><li>release_date: The date the movie was released.</li><li>overview: A brief description of the movie.</li></ul><h4>4. Extracting Data from the Response</h4><pre>for i in response[&#39;results&#39;]:<br>    title.append(i[&#39;title&#39;])<br>    popularity.append(i[&#39;popularity&#39;])<br>    vote_count.append(i[&#39;vote_count&#39;])<br>    original_language.append(i[&#39;original_language&#39;])<br>    vote_average.append(i[&#39;vote_average&#39;])<br>    release_date.append(i[&#39;release_date&#39;])<br>    overview.append(i[&#39;overview&#39;])</pre><p>This loop goes through each movie in the response[&#39;results&#39;] list and appends the relevant details to their corresponding lists. The API response contains a results field, which is a list of dictionaries, each representing a movie.</p><h4>5. Creating a DataFrame for Each Page</h4><pre>d={&#39;title&#39;:title,&#39;overview&#39;:overview,&#39;popularity&#39;:popularity,&#39;vote_count&#39;:vote_count,&#39;original_language&#39;:original_language,&#39;vote_average&#39;:vote_average,&#39;release_date&#39;:release_date}<br>df=pd.DataFrame(d)</pre><p>Once the data for a page is extracted, we convert it into a <strong>Pandas DataFrame</strong> using the dictionary d. This makes it easier to analyze and manipulate the data in a tabular format. The DataFrame will have columns for each of the movie attributes.</p><h4>6. Aggregating Data Across Pages</h4><pre>final = pd.concat([final, df], ignore_index=True)</pre><p>After each page’s data is fetched and converted into a DataFrame, it’s <strong>concatenated</strong> with the final DataFrame. This means all the data from each page is combined into a single DataFrame that will contain movie data from across all pages. The ignore_index=True argument ensures that the indices are properly aligned across the concatenated DataFrames.</p><h4>7. Optional: Appending Data (Commented Out)</h4><pre>#final=final.append(df, ignore_index=True)</pre><p>This line is commented out but shows an alternative approach to adding data to the final DataFrame. The append() method would also work, but <strong>pd.concat()</strong> is generally preferred because it&#39;s faster and more efficient when combining large datasets.</p><h4>8. Saving the Final Data to a CSV File</h4><pre>final.to_csv(&#39;tmdb.csv&#39;, index=False)</pre><p>After all the pages have been processed and the final DataFrame is populated, the script saves the movie data to a <strong>CSV file</strong> called tmdb.csv. The index=False argument ensures that the index column is not included in the output file, making it cleaner when you open it in a spreadsheet application.</p><h3>Final Thoughts</h3><p>The script continues to loop through the pages of the TMDB API and gathers data on <strong>popular movies</strong>. By the end of the loop, the final DataFrame will contain information on up to <strong>500 pages worth of popular movies</strong>, each with their title, popularity score, vote count, language, average vote, release date, and overview.</p><h4>Key Takeaways:</h4><ol><li><strong>API Requests:</strong> You can use requests.get() to interact with REST APIs and fetch data.</li><li><strong>Pagination:</strong> The API supports pagination, which allows you to fetch large datasets by requesting different pages.</li><li><strong>Pandas for Data Processing:</strong> Pandas makes it easy to structure and manipulate the data in a way that can be analyzed or saved to a CSV file.</li><li><strong>Data Aggregation:</strong> Using pd.concat() efficiently combines data from multiple sources into one DataFrame.</li><li><strong>Saving to CSV:</strong> You can easily save your DataFrame to a CSV file for future analysis or sharing.</li></ol><p>This code can be modified to retrieve different types of movie data from the API (e.g., top-rated movies, upcoming releases) or even to fetch data from other APIs.</p><p>For more of my data science projects and tutorials, feel free to check out my <strong>Kaggle profile</strong>: <a href="https://www.kaggle.com/atul2501a">Atul2501a on Kaggle</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0cf8d9ecd45" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Data Analysis Process: A Step-by-Step Guide]]></title>
            <link>https://medium.com/@yatul247/the-data-analysis-process-a-step-by-step-guide-aa1348f8fc5d?source=rss-fb5f26f08a44------2</link>
            <guid isPermaLink="false">https://medium.com/p/aa1348f8fc5d</guid>
            <category><![CDATA[data-analysis-process]]></category>
            <dc:creator><![CDATA[Atul Yadav]]></dc:creator>
            <pubDate>Mon, 31 Mar 2025 09:55:30 GMT</pubDate>
            <atom:updated>2025-03-31T09:55:30.015Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Data Analysis Process</h3><p>Data analysis is a structured process that helps us extract meaningful insights from raw data. Whether you’re working with business, scientific, or social data, following a systematic approach can lead to more effective decision-making. In this article, we’ll explore the essential steps of the data analysis process.</p><h3>Step 1: Asking Questions</h3><p>The first step in any data analysis process is identifying the right questions to ask. Well-defined questions help shape the direction of the analysis. Consider asking:</p><ul><li>Which features contribute most to my analysis?</li><li>Which features are not important?</li><li>Which features have strong correlations?</li><li>Do I need data preprocessing?</li><li>What kind of feature engineering is required?</li></ul><p>To ask better questions, leverage:</p><ol><li>Subject matter expertise</li><li>Experience</li></ol><h3>Step 2: Data Wrangling / Munging</h3><p>Once you have a clear objective, the next step is preparing the data for analysis. This involves gathering, assessing, and cleaning the data.</p><h3>2a) Gathering Data</h3><p>Data can be collected from various sources, such as:</p><ul><li>CSV files</li><li>APIs</li><li>Web scraping</li><li>Databases</li></ul><h3>2b) Assessing Data</h3><p>Before analysis, it’s crucial to assess data quality by:</p><ul><li>Finding the number of rows and columns (shape)</li><li>Checking data types of various columns</li><li>Identifying missing values</li><li>Checking for duplicate data</li><li>Determining memory usage</li><li>Conducting a high-level mathematical overview (summary statistics)</li></ul><h3>2c) Cleaning Data</h3><p>Cleaning ensures the data is reliable and usable. This includes:</p><ul><li>Handling missing values (e.g., replacing with mean)</li><li>Removing duplicate entries</li><li>Correcting data types (e.g., converting to appropriate formats)</li></ul><h3>Step 3: Exploratory Data Analysis (EDA)</h3><p>EDA helps in understanding the patterns and relationships in data. It involves:</p><h3>3a) Exploring Data</h3><ul><li>Finding correlations and covariances</li><li>Performing univariate and multivariate analysis</li><li>Visualizing data using graphs and charts</li></ul><h3>3b) Augmenting Data</h3><ul><li>Identifying outliers using boxplots</li><li>Merging or transforming features</li><li>Adding new columns (Feature Engineering)</li></ul><h3>Step 4: Drawing Conclusions</h3><p>Data analysis is incomplete without drawing meaningful conclusions. This step involves using:</p><ul><li><strong>Descriptive statistics</strong> — Summarizing data trends</li><li><strong>Inferential statistics</strong> — Making predictions and inferences</li><li><strong>Machine learning models</strong> (if applicable)</li></ul><h3>Example Questions Answered Using Data</h3><ul><li>Is Rohit Sharma a better batsman in 2nd innings? (Using IPL dataset)</li><li>Does being female increase survival chances? (Using Titanic dataset)</li><li>Is Delhi the most expensive city for dining out? (Using Zomato dataset)</li></ul><h3>Step 5: Communicating Results</h3><p>Finally, insights must be communicated effectively. Data storytelling helps in:</p><ul><li>Presenting findings in <strong>in-person meetings</strong></li><li>Creating <strong>reports</strong></li><li>Writing <strong>blog posts</strong></li><li>Designing <strong>PPT slides / deck presentations</strong></li></ul><h3>Conclusion</h3><p>The data analysis process is iterative and interconnected. Asking the right questions, cleaning and exploring data, drawing meaningful conclusions, and effectively communicating results are key to making data-driven decisions. Whether you’re a beginner or an experienced analyst, following this structured approach will help you derive the best insights from your data.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aa1348f8fc5d" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>