text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
the columns are called my code just
4,301.28
4.2
keeps working and so it keeps getting if
4,303.679
4.201
you will better and better
4,305.48
5.699
any questions now on this approach yeah
4,307.88
6
what is the importance of online CSV
4,311.179
4.321
file what's the importance of the new
4,313.88
3.96
line in the CSV file it's partly a
4,315.5
4.38
convention in the world of text files we
4,317.84
3.839
humans have just been for decades in the
4,319.88
5.22
habit of storing data line by line it's
4,321.679
6.06
visually convenient it's just easy to
4,325.1
4.32
extract from the file because you just
4,327.739
3.721
look for the new lines so the new line
4,329.42
5.04
just separates some data from some other
4,331.46
5.58
data we could use any other symbol on
4,334.46
4.56
the keyboard but it's just common to hit
4,337.04
3.84
enter to just move the data to the next
4,339.02
3.659
line just a convention
4,340.88
4.26
other questions it seems to be working
4,342.679
5.52
fine if you just have name and home I'm
4,345.14
5.28
wondering what will happen if you want
4,348.199
5.46
to put in more data
4,350.42
4.2
um
4,353.659
4.441
say you wanted to add a house to both
4,354.62
5.64
the name and the home
4,358.1
4.079
sure if you wanted to add the house back
4,360.26
3.899
so if I go in here and add house last
4,362.179
5.221
and I go here and say uh Gryffindor for
4,364.159
6.901
Harry Gryffindor for Ron and Slytherin
4,367.4
6.54
for Draco now I have three columns
4,371.06
4.619
effectively if you will home on the left
4,373.94
4.02
name in the middle house on the right
4,375.679
4.621
each separated by commas with weird
4,377.96
4.199
things like number four comma privet
4,380.3
4.32
Drive still quoted notice if I go back
4,382.159
4.441
to students.pi and I don't change the
4,384.62
4.32
code at all and run python of
4,386.6
5.04
students.pi it still just works and this
4,388.94
4.56
is what's so powerful about a dictionary
4,391.64
4.38
reader it can change over time it can
4,393.5
4.98
have more and more columns your existing
4,396.02
4.86
code is not going to break your code
4,398.48
4.259
would break would be much more fragile
4,400.88
3.299
so to speak if you were making
4,402.739
3.301
assumptions like the first column's
4,404.179
3.181
always going to be named the second
4,406.04
3.24
column's always going to be house things
4,407.36
3.9
will break fast if those assumptions
4,409.28
3.3
break down
4,411.26
3.479
so not a problem in this case
4,412.58
4.56
well let me propose that besides reading
4,414.739
4.44
csvs let's at least take a peek at how
4,417.14
4.5
we might write a csv2 if you're writing
4,419.179
4.381
a program in which you want to store not
4,421.64
3.539
just students names but maybe their
4,423.56
3.9
homes as well in a file how can we keep
4,425.179
4.621
adding to this file let me go ahead and
4,427.46
5.279
delete the contents of students.csv and
4,429.8
5.399
just re-add a single simple row name
4,432.739
5.821
comma home so as to anticipate inserting
4,435.199
5.581
more names and homes into this file and
4,438.56
4.38
then let me go to students.pi and let me
4,440.78
4.379
just start fresh so as to write out data
4,442.94
3.36
this time I'm still going to go ahead
4,445.159
3.781
and import CSV I'm going to go ahead now
4,446.3
5.52
and prompt the user for their name so
4,448.94
5.34
input quote unquote what's your name
4,451.82
4.56
question mark and I'm going to go ahead
4,454.28
4.32
and prompt the user for their home so
4,456.38
5.04
home equals input quote unquote where's
4,458.6
6.18
your home question mark now I'm going to
4,461.42
5.16
go ahead and open the file but this time
4,464.78
3.72
for writing instead of reading as
4,466.58
5.119
follows with open quote unquote
4,468.5
5.94
students.csv I'm going to open in append
4,471.699
4.841
mode so that I keep adding more and more
4,474.44
4.14
students and homes to the file rather
4,476.54
3.72
than just overwriting the entire file
4,478.58
3.3
itself and I'm going to use a variable
4,480.26
4.14
name of file I'm then going to go ahead
4,481.88
4.44
and give myself a variable called writer
4,484.4
3.6
and I'm going to set it equal to the
4,486.32
3.78
return value of another function in the
4,488
5.34
CSV module called CSV dot writer and
4,490.1
6.42
that writer function takes as its sole
4,493.34
7.02
argument the file variable there now I'm
4,496.52
5.1
going to go ahead and just do this I'm
4,500.36
3.78
going to say writer dot right row and
4,501.62
4.98
I'm going to pass into right Row the
4,504.14
4.8
line that I want to write to the file
4,506.6
4.32
specifically as a list so I'm going to
4,508.94
4.86
give this a list of name comma home
4,510.92
4.2
which of course are the contents of
4,513.8
3.06
those variables now I'm going to go
4,515.12
3.539
ahead and save the file I'm going to go
4,516.86
4.319
ahead and rerun python of students.pi
4,518.659
4.921
hit enter and what's your name well let
4,521.179
4.441
me go ahead and type in Harry as my name
4,523.58
5.159
and number four
4,525.62
7.14
comma privet Drive enter now notice that
4,528.739
6.661