How to extract Hourwise temperature of major cities using Python?

117 views Asked by At

How can I extract temperature record of Indian cities on a specific day (say Feb 20, 2022) using web scrapping techniques in Python? Let’s consider the cities are Noida, New Delhi, Gurgaon, Chennai etc. Suppose we have a list of 200 Indian cities and I want to extract hourwise temperature of all these cities on February 20,2022 and want to save it in .csv file. The saved file should contain the following information: cities, 00:00:00, 01:00:00, 02:00:00, ........, 22:00:00, 23:00:00 New Delhi, 18, 18,19,.....,14, 15

Here, New Delhi is a cityname and 18, 18, 19 are temperatures in degree celsius at time 00:00:00, 01:00:00, 02:00:00 respectively. I want to save all records in comma separated values (csv) suppose I enter the city name in list, then my input would be:

Input: cities= ['New Delhi', 'Gurgaon', 'Noida', 'Chennai']

Suppose we want the temperature of cities in degree Celsius on February 20, 2022, then output should be in csv format as following:

output:

cities,00,01,02,03,04,05,06,07,08,09,........,21,22,23   
New Delhi, 18,18,19,19,19,20,20,20,20,21,.....,15,14,15

Gurgaon, 18,17,17,17,19,19,20,20,19, .......,17,14,13

Noida,17,17,17,17,16,16,17,17,16,.......,16,15,12

chennai, 19,19,19,20,20,20,20,21,21,.....,22,22,21
0

There are 0 answers