How it works...
There are a wide number of methods that can be used to create DataFrame. Here are some of the most frequently used methods:
-
By using keyword arguments, for example, DataFrame(a=[1, 2], b = "s") (the scalar in column :b will be converted to a vector of appropriate length)
-
By passing column types, column names, and number of rows; for example, DataFrame([Int, String], [:a, :b], 2) will create a data frame with two columns that are uninitialized
-
By passing a vector of data vectors and, optionally, column names, for example, DataFrame([[1, 2], ["a", "b"]], [:a, :b])
An important feature of DataFrame constructors is that if you pass a vector of data as a column, this vector is not copied. In other words, a variable is passed ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access