Numpy Python Solution part27 [w/ subs]



00:00:03 – to see my solution let's go to the
00:00:05 – ipython notebook and select the 458
00:00:07 – challenge begin
00:00:09 – notebook in this notebook have copied
00:00:12 – all the code that we've developed so far
00:00:14 – in this chapter 11 wait all sales let's
00:00:19 – first collect all the data that we need
00:00:20 – we use the get-ups function that we
00:00:25 – developed together let's not forget to
00:00:31 – integrate the missing temperatures using
00:00:33 – the field and function that we also
00:00:35 – developed together to find a year with
00:00:38 – the highest mean maximum temperature in
00:00:40 – minneapolis we will again assembled an
00:00:42 – array of all years and compute the mean
00:00:44 – across each row we consider years
00:00:47 – between nineteen forty and 2014
00:00:50 – it goes without saying that the second
00:00:52 – index in a range is not included in the
00:00:54 – resulting list use the function select
00:00:57 – year to return the data for the
00:00:59 – individual years they call it the first
00:01:02 – round in 65 days for simplicity and loop
00:01:05 – over the years that we are considering i
00:01:08 – missed one argument for the function
00:01:11 – select hear that mean certain it as for
00:01:14 – the mean we can apply a numpy not mean
00:01:17 – to disarray only across rows let's have
00:01:21 – a look
00:01:22 – looks reasonable we find the index of
00:01:26 – the maximum value using numpy argh Max
00:01:29 – and we can use the index to get the
00:01:33 – actual year 2012
00:01:36 – let's do the same for San Diego with the
00:01:40 – copy and paste and replace Minneapolis
00:01:42 – with San Diego and tmax with him in
00:01:46 – Arkham
00:01:49 – not at max 1948 okay we just need to
00:01:54 – plot now I'll grab the data for
00:01:57 – minneapolis you may remember that matlab
00:02:01 – field between actually requires an array
00:02:04 – for the horizontal axis we build this
00:02:08 – will not be airange it turns out that
00:02:11 – both 1948 and 2012 where leap years so
00:02:16 – we'll go from one to three hundred sixty
00:02:18 – six straight out for a moment looks fine
00:02:22 – I'll do the same for San Diego let me
00:02:25 – give the two bands different colors and
00:02:29 – that we make them partly transparence
00:02:31 – and we also limit the horizontal axis to
00:02:35 – 366 while I'm doing this I can also
00:02:40 – change the size of the figure and I can
00:02:43 – give it a title here we go this is the
00:02:47 – final product for this challenge as you
00:02:50 – can tell the 2012 Minnesota and summer
00:02:53 – was rather brutal compared to san diego
00:02:55 – milder weather


Video Url:
http://youtu.be/yv1wc-sCKv0

(Visited 2 times, 2 visits today)

Comments

comments