Giter Site home page Giter Site logo

ausboone / weather-data-scraper Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 7 KB

This is a Python script that scrapes daily average temperature data for a specified city and date range from weather.com.

License: MIT License

Python 100.00%
beautifulsoup4 data-science pandas python scraper scraping environmental-science webscraping webscraping-data

weather-data-scraper's Introduction

Weather Data Scraper

This is a Python script that scrapes daily average temperature data for a specified city and date range from weather.com. The script uses the following Python libraries:

requests - Used to send HTTP requests to the website and retrieve the HTML content. beautifulsoup4 - Used to parse the HTML content and extract the temperature data. pandas - Used to store the temperature data in a DataFrame and perform data analysis. matplotlib - Used to create a line chart of the daily average temperatures. datetime - Used to handle date objects and convert between date formats.

Usage

To use the script, you need to specify the city name and the date range for which you want to scrape the temperature data. To do this, modify the following lines of code in the script:

city = 'New York, NY' start_date = '2022-01-01' end_date = '2022-01-31'

Replace 'New York, NY' with the name of the city you want to scrape data for, and '2022-01-01' and '2022-01-31' with the start and end dates of the date range you want to scrape data for.

Once you've modified these lines of code, you can run the script using the following command:

python weather_data_scraper.py

The script will scrape the temperature data, save it to a CSV file named weather_data.csv, and then analyze and plot the data. You can find the CSV file and the plot in the same directory where you saved the script.

Imports

Here's an explanation of why each import is required:

requests - Used to send HTTP requests to the website and retrieve the HTML content. beautifulsoup4 - Used to parse the HTML content and extract the temperature data. pandas - Used to store the temperature data in a DataFrame and perform data analysis. matplotlib - Used to create a line chart of the daily average temperatures. datetime - Used to handle date objects and convert between date formats.

weather-data-scraper's People

Contributors

ausboone avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.