https://pandas.pydata.org/pandas-docs/stable/generated/pandas.DataFrame.index.html

source

00:00 all right so pandas dataframe index what

00:06 does an assay in the index row levels of

00:10 the data frame all right so let's import

00:13 ten is SPE and import numpy FMP and then

00:20 actually if we go to the essential basic

00:23 functionality we see some examples here

00:25 we see that if we have a series that

00:28 pandas in from index gives back the

00:31 index so let's create a series s is PD

00:34 series MP random random normal generate

00:42 five animals with the index is going a b

00:46 c d and e so if we know type s dot index

00:55 we get back the index actually add index

01:01 so it returns it as an index if we have

01:06 a data frame so we first create a data

01:08 frame index is pd date range starting

01:12 from say 1 1 2000 periods is 8 and DF is

01:21 p data frame and p random random normal

01:27 8 3 index is index and columns is a pc a

01:35 B and C then if we type DF index we get

01:44 back the index as actually a date/time

01:47 index why do we get back at day time

01:49 index because we told index to be index

01:54 where index is a daytime object so if we

01:58 want to get like this is a list we can

02:03 type to list behind it so for example we

02:08 can type s index to list

02:12 which guess a list of the indices and

02:16 here DF index to list also works but you

02:22 get it in time stamps so you'll have to

02:24 convert those to string let me see if I

02:29 can do that actually for you now

02:34 [Music]

02:40 so date time index to string string of

02:48 time all right

02:51 skirt of time for example this okay so

03:00 um let's see

03:02 DF and next time let's see if this works

03:11 okay yeah so now you get them as unicode

03:16 so you can convert the day time index to

03:21 a string with string at time

## Leave a Reply