[263]: time city_name wind_speed 0 2015-01-01 03:00:00 5 2015-01-01 06:00:00 6 2015-01-01 06:00:00 7 2015-01-01 06:00:00

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

[263]: time city_name wind_speed 0 2015-01-01 03:00:00 5 2015-01-01 06:00:00 6 2015-01-01 06:00:00 7 2015-01-01 06:00:00

Post by answerhappygod »

263 Time City Name Wind Speed 0 2015 01 01 03 00 00 5 2015 01 01 06 00 00 6 2015 01 01 06 00 00 7 2015 01 01 06 00 00 1
263 Time City Name Wind Speed 0 2015 01 01 03 00 00 5 2015 01 01 06 00 00 6 2015 01 01 06 00 00 7 2015 01 01 06 00 00 1 (118.18 KiB) Viewed 12 times
I have a large dataset in front of me. It starts from 2015-01-01
03:00:00, and goes all the way up to to 2018. I plan on removing
the "city_names" column. As you can see, the dataset is grouped in
5 pairs - according to date and 3-hour time intervals. I need a
python code that will find the mean or median for each 5 group
pair, per column. Essentially, it will need to look like the
following:
263 Time City Name Wind Speed 0 2015 01 01 03 00 00 5 2015 01 01 06 00 00 6 2015 01 01 06 00 00 7 2015 01 01 06 00 00 2
263 Time City Name Wind Speed 0 2015 01 01 03 00 00 5 2015 01 01 06 00 00 6 2015 01 01 06 00 00 7 2015 01 01 06 00 00 2 (18.9 KiB) Viewed 12 times
[263]: time city_name wind_speed 0 2015-01-01 03:00:00 5 2015-01-01 06:00:00 6 2015-01-01 06:00:00 7 2015-01-01 06:00:00 8 2015-01-01 06:00:00 pressure humidity rain_3h Seville 3.333333 sp25 74.333333 1 2015-01-01 03:00:00 Madrid 0.666667 971.333333 64.000000 2 2015-01-01 03:00:00 Bilbao 1.000000 1035.0 0.0000oo 3 2015-01-01 03:00:00 Valencia 0.666667 1002.666667 75.666667 4 2015-01-01 03:00:00 Barcelona 6.333333 1036.333333 0.000000 Seville 3.333333 sp25 78.333333 Madrid 0.333333 972.666667 64.666667 Bilbao 1.000000 1035.666667 0.000000 Valencia 1.666667 1004.333333 71.000000 Barcelona 4.000000 1037.333333 0.000000 Seville 2.666667 sp25 71.333333 Madrid 1.000000 974.0 64.333333 Bilbao 1.000000 1036.0 0.000000 Valencia 1.000000 1005.333333 65.666667 Barcelona 2.000000 1038.0 0.000000 Seville 4.000000 sp25 65.333333 Madrid 1.000000 994.666667 56.333333 Bilbao 1.000000 Valencia 1.000000 2.333333 9 2015-01-01 06:00:00 10 2015-01-01 09:00:00 11 2015-01-01 09:00:00 12 2015-01-01 09:00:00 13 2015-01-01 09:00:00 14 2015-01-01 09:00:00 15 2015-01-01 12:00:00 16 2015-01-01 12:00:00 17 2015-01-01 12:00:00 18 2015-01-01 12:00:00 19 2015-01-01 12:00:00 Barcelona 1036.0 0.000000 1009.0 54.000000 1037.0 0.000000 temp_min 0.0 274.254667 0.0 274.254667 0.0 265.938000 0.0 265.938000 0.0 269.338615 223.333333 269.338615 0.0 269.888000 level 5 269.888000 0.0 281.013000 42.666667 281.013000 0.0 274.945000 0.0 274.945000 0.0 266.386667 0.0 266.386667 0.0 270.376000 221.0 270.376000 0.0 271.728333 level 10 271.728333 0.0 280.561667 139.0 280.561667 0.0 278.792000 0.0 278.792000 0.0 272.708667 0.0 272.708667 0.0 275.027229 214.333333 275.027229 0.0 278.008667 level 9 278.008667 0.0 281.583667 326.0 281.583667 0.0 285.394000 0.0 285.394000 0.0 281.895219 0.0 281.895219 0.0 281.135063 199.666667 281.135063 0.0 284.899552 level 8 284.899552 0.0 283.434104 273.0 283.434104 wind_deg temp_max clouds_all weather_id rain_1h 0.0 800.0 0.0 800.0 0.0 800.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 800.0 800.0 800.0 800.0 0.0 800.0 800.0 800.0 800.0 0.0 800.0 800.0 800.0 800.0 0.0 800.0 0.0 temp snow_3h 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 274.254667 0.0 265.938000 0.0 269.338615 0.0 269.888000 0.0 281.013000 0.0 274.945000 0.0 266.386667 0.0 270.376000 0.0 271.728333 0.0 280.561667 0.0 278.792000 0.0 272.708667 0.0 275.027229 0.0 278.008667 0.0 281.583667 0.0 285.394000 0.0 281.895219 0.0 281.135063 0.0 284.899552 0.0 283.434104

time 0 2015-01-01 03:00:00 1 2015-01-01 06:00:00 2 2015-01-01 09:00:00. continue..... wind_speed mean or median (0 to 4) mean or median (5 to 9) mean or median (10 to 14) pressure mean or median (0 to 4) mean or median (5 to 9) mean or median (10 to 14) humidity mean or median (0 to 4) mean or median (5 to 9) mean or median (10 to 14) rain_3h mean or median (0 to 4) mean or median (5 to 9) mean or median (10 to 14) temp_min. etc etc mean or median (0 to 4) etc. mean or median (5 to 9) etc. mean or median (10 to 14) etc
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply