WEBVTT

00:00.840 --> 00:06.040
In this video we are going to impart our very first time series data and then our fights.

00:06.060 --> 00:12.330
We have a CSG fight called temperature or temp and it contains temperature information for New York

00:12.360 --> 00:14.310
and Los Angeles for the yes.

00:14.370 --> 00:19.800
2013 to 2016 and in a very first step.

00:19.840 --> 00:27.240
Is actually no difference between importing longtime serious data and time serious data from CSP fires.

00:27.240 --> 00:33.040
So first of all we import pandas and then we are using the method.

00:33.090 --> 00:34.190
Read CSB.

00:34.880 --> 00:41.730
So we are importing our CSP fire temperature our temp and we actually store our new data frame then

00:42.030 --> 00:51.060
in the web temperature and let's have a very first look at our data frame so we we can see the first

00:51.060 --> 00:54.420
five rows and actually we have a sweet column.

00:54.420 --> 01:01.650
So we have the column date time we have L.A. for Los Angeles and we have New York and apparently here

01:01.680 --> 01:08.820
as well use of our data frame we have actually the temperature at this specific time in these specific

01:08.970 --> 01:14.560
city and the temperature is actually in degrees Celsius.

01:14.560 --> 01:21.760
So for example here we have January eleven point seven in L.A. and minus one point one degrees Celsius

01:21.790 --> 01:23.290
in New York.

01:23.290 --> 01:30.760
So let's get some meta information with the info method and on the left hand side we have a range index

01:30.820 --> 01:34.770
and we have actually thirty five thousand sixty four rows.

01:34.840 --> 01:42.260
So we have over thirty five thousand different the timestamps here and with actually three columns.

01:42.260 --> 01:48.050
So we have the date time column and obviously here we have string data type.

01:48.050 --> 01:55.190
So here we have object and this is a clear indication that to we to the strings in the column then we

01:55.190 --> 01:59.130
have the column in The Los Angeles service the flow data types.

01:59.150 --> 02:04.130
So these are your degrees Celsius values and therefore float the data type.

02:04.130 --> 02:10.000
Makes sense and also here for the New York column we have also a float data type.

02:10.730 --> 02:17.870
So the first problem is here that in the daytime column we actually do not have a specific date time

02:17.870 --> 02:18.900
data type.

02:19.040 --> 02:25.400
So we have a string that I type and this might not be really helpful and therefore on a first step we

02:25.400 --> 02:32.030
can try to transform data information that this actually starts here and strings into a date time data

02:32.060 --> 02:39.260
type of format and we can do this immediately when we import the data frame so they read CSP method

02:39.260 --> 02:47.630
provide some parameters that helps to import the date time information and let's go inside and if we

02:47.630 --> 02:54.770
can see that we have the pyramid up past dates and by default it set to false but let's have a look

02:54.770 --> 02:55.480
here.

02:55.580 --> 03:02.720
So apostates and Tippett can actually pass column labels for columns that we want to transform from

03:02.840 --> 03:11.420
string data type to a date time data type and we have to do this as a list and obviously our column

03:11.450 --> 03:14.460
that we want to transform a the daytime column.

03:14.540 --> 03:23.250
So we pass the time and we can also look at the documentation for the past dates power Mehta

03:27.970 --> 03:29.450
so weird us.

03:29.560 --> 03:36.280
And for example here we can pass the Boolean value true and then pan out tries to pass them the index

03:36.280 --> 03:37.940
into a date time format.

03:38.020 --> 03:40.870
But obviously here we have a Range Index.

03:40.870 --> 03:46.710
So we do not have any date time information on the index or we can pass a list of integers or names

03:46.750 --> 03:53.890
so we can pass either a list with the index position of the columns or the column labels and this is

03:53.890 --> 04:00.460
exactly what we do what we do here we pass that the column label daytime and let's see what we got here.

04:00.610 --> 04:07.510
So we actually overwriting our variable temperature and let's have a look here again at the Inform method

04:08.420 --> 04:15.990
and here we can see now that the data type changed from object to a daytime 64 ante and spat brackets

04:16.000 --> 04:17.550
we have an annual seconds.

04:17.890 --> 04:22.800
So the position is nanoseconds if we want to have this.

04:22.900 --> 04:27.000
So now we can also update you on the view on the first five rows.

04:27.650 --> 04:32.930
And now we have had the column date time with the data type date times 64.

04:33.290 --> 04:40.000
And we can also slice your fun element in our daytime column and we can select here the very first element

04:40.450 --> 04:42.360
myth of the ILO operator.

04:44.650 --> 04:50.780
And here we have a so-called timestamp and a time stamp is actually a single point in time.

04:50.800 --> 04:58.600
So for example here we have the year 2013 we have a 10 year Ria and we have it and you read the first

04:59.080 --> 05:01.600
and then also we have information on the time.

05:01.600 --> 05:03.660
So we have at midnight here.

05:03.700 --> 05:04.980
So these are the hours.

05:04.990 --> 05:08.380
Then we have minutes and then seconds.

05:08.560 --> 05:13.530
And as you can see above our data frame provides hourly temperature information.

05:13.660 --> 05:21.730
So the increment this one hour and we're starting here with the January the 1st at midnight then our

05:21.730 --> 05:25.060
next timestamp is this third January the 1st.

05:25.060 --> 05:33.640
1:00 a.m. Then we have 2:00 a.m. 3:00 and so on and we can also check here the data type off the time

05:33.640 --> 05:35.670
stamp of that type of method

05:40.270 --> 05:43.510
and this is here a panda's timestamp.

05:43.780 --> 05:50.140
So the timestamp is a specific Panda's data type to store daytime information.

05:50.140 --> 05:56.290
And whenever we have daytime information like this it makes sense to have the daytime as the index of

05:56.290 --> 05:57.520
our data frame.

05:57.760 --> 06:01.600
And by doing so this gives us a lot of additional functionality.

06:02.660 --> 06:09.200
So we can already do this when we import our data obviously read CSA method and we've already seen that

06:09.220 --> 06:11.540
that is that the parameter index calls

06:15.450 --> 06:20.850
and Tippecanoe past the column labor for the column that you want to have as index and in this case

06:20.850 --> 06:23.130
it's your day time.

06:23.160 --> 06:29.250
So this is actually a very common workflow with time series that when we import the data we first of

06:29.250 --> 06:36.950
all pass the columns that contain the daytime information with the parent to pass dates and then being

06:36.950 --> 06:39.840
can to these columns as the index.

06:39.840 --> 06:42.870
So let's do this here and be all right.

06:42.870 --> 06:50.640
Our variable temperature and have again a look at the first five rows and now we can see here that we

06:50.640 --> 06:52.150
have our daytime column.

06:52.150 --> 07:01.630
Now as the index and we can also check this with the informal method so we can see here that we have

07:01.660 --> 07:11.980
a so-called daytime index and we have 35000 entries and these range from January the 1st 2013 midnight

07:12.220 --> 07:18.980
until December thirty first of 2016 11:00 p. m..

07:19.060 --> 07:26.500
So we feel all the temperature information for New York and Los Angeles for the year 2000 and 30 into

07:26.500 --> 07:28.090
2016.

07:28.990 --> 07:34.610
And we can also call you to the index attribute to further analyze our new index.

07:34.720 --> 07:39.980
And here we have our daytime index until we have all of the timestamps.

07:40.060 --> 07:46.180
So a daytime index is actually the collection of many timestamps and we can see at the bottom that we

07:46.180 --> 07:54.940
have the data type daytime 64 and index label we have daytime and we have thirty five thousand entries

07:56.020 --> 08:02.620
and we can also select a single element in our index so let's select the very first element and this

08:02.620 --> 08:04.730
is here the very first timestamp.

08:04.930 --> 08:09.030
So January of the 1st 2013 at midnight.

08:09.070 --> 08:09.550
All right.

08:09.550 --> 08:15.670
This were the first steps with time series and I hope to see you also in the next video by.
