text
stringlengths
1
81
start
float64
0
10.1k
duration
float64
0
24.9
value from another in other scenarios
1,737.24
4.26
you might very well want to keep that
1,739.58
3.54
line ending because it's a very long
1,741.5
3.72
series of text or a parallel graph or
1,743.12
3.36
something like that where you want to
1,745.22
2.939
keep it distinct from the others but
1,746.48
3.9
it's just a convention we have to use
1,748.159
4.861
something presumably to separate one
1,750.38
4.919
chunk of text from another there are
1,753.02
4.32
other functions in Python that will in
1,755.299
4.021
fact handle the removal of that white
1,757.34
4.439
space for you read lines though does
1,759.32
4.02
literally that though it reads all of
1,761.779
4.561
the lines as is well allow me to turn
1,763.34
5.16
our attention back to where we left off
1,766.34
4.559
here which is just names to propose that
1,768.5
5.159
with names.text we have an ability it
1,770.899
4.38
seems to store each of these names
1,773.659
3.721
pretty straightforwardly but what if we
1,775.279
3.241
wanted to keep track of other
1,777.38
3.299
information as well suppose that we
1,778.52
5.039
wanted to store information including a
1,780.679
6.301
student's uh name and their house at
1,783.559
5.521
Hogwarts be it Gryffindor or Slytherin
1,786.98
4.439
or something else well where do we go
1,789.08
4.26
about putting that you know Hermione
1,791.419
3.36
lives in Gryffindor so we could do
1,793.34
3
something like this in our text file
1,794.779
3.9
Harry lives in Gryffindor so we could do
1,796.34
4.559
that Ron lives in Gryffindor so we could
1,798.679
4.441
do that and Draco lives in Slytherin so
1,800.899
5.701
we could do that but I worry here
1,803.12
5.52
but I worry now that we're mixing apples
1,806.6
4.079
and oranges so to speak like some lines
1,808.64
4.32
or names some lines are houses so this
1,810.679
4.201
probably isn't the best design if only
1,812.96
3.78
because it's confusing or it's ambiguous
1,814.88
4.08
so maybe what we could do is Adopt A
1,816.74
3.84
convention and indeed this is in fact
1,818.96
4.079
what a lot of programmers do they change
1,820.58
5.16
this file not to be names.text but
1,823.039
4.64
instead let me create a new file called
1,825.74
5.46
names.csv CSV stands for comma separated
1,827.679
5.38
values and it's a very common convention
1,831.2
4.02
to store multiple pieces of information
1,833.059
5.401
that are related in the same file and so
1,835.22
5.1
to do this I'm going to separate each of
1,838.46
4.02
these types of data not with another new
1,840.32
4.5
line but simply with a comma I'm going
1,842.48
4.199
to keep each student on their own line
1,844.82
3.3
but I'm going to separate the
1,846.679
3.541
information about each student using a
1,848.12
4.679
comma instead and so now we sort of have
1,850.22
4.92
a two-dimensional file if you will row
1,852.799
4.561
by row we have our students but if you
1,855.14
4.44
think of these commas as representing a
1,857.36
3.72
column even though it's not perfectly
1,859.58
2.939
straight because of the lengths of these
1,861.08
4.199
names it's a little it's a little Jagged
1,862.519
4.02
you can think of these commas as
1,865.279
3.601
representing a column and it turns out
1,866.539
4.98
these CSV files are very commonly used
1,868.88
4.44
when you use something like Microsoft
1,871.519
3.54
Excel Apple numbers or Google
1,873.32
3.54
spreadsheets and you want to export the
1,875.059
4.5
data to share with someone else as a CSV
1,876.86
5.699
file or conversely if you want to import
1,879.559
5.401
a CSV file into your preferred
1,882.559
4.441
spreadsheet software like Excel or
1,884.96
3.9
numbers or Google spreadsheets you can
1,887
4.2
do that as well so CSV is a very common
1,888.86
4.74
very simple text format that just
1,891.2
5.04
separates values with commas and
1,893.6
4.079
different types of values ultimately
1,896.24
3.72
with new lines as well let me go ahead
1,897.679
5.22
and run code of students.csv to create a
1,899.96
4.559
brand new file that's initially empty
1,902.899
3.841
and we'll add to it those same names but
1,904.519
4.561
also some other information as well so
1,906.74
5.279
if I now have this new file students.csv
1,909.08
5.459
inside of which is one column of name so
1,912.019
4.921
to speak and one column of houses how do
1,914.539
4.5
I go about changing my code to read not
1,916.94
4.02
just those names but also those names
1,919.039
3.661
and houses so that they're not all on
1,920.96
3.9
one line we somehow have access to both
1,922.7
4.74
type of value separately play well let
1,924.86
3.72
me go ahead and create a new program
1,927.44
2.78
here called
1,928.58
4.56
students.pi and in this program let's go
1,930.22
5.199
about reading not a text file per se but
1,933.14
4.74
a specific type of text file a CSV a
1,935.419
4.921
comma separated values file and to do
1,937.88
3.84
this I'm going to use similar code as
1,940.34
4.38
before I'm going to say with open quote
1,941.72
4.04
unquote
1,944.72
3.179
students.csv I'm not going to bother
1,945.76
3.88
specifying quote unquote R because again
1,947.899
3.241
that's the default but I'm going to give
1,949.64
4.44
myself a variable name of file and then
1,951.14
4.44