// plain
Dataframes in JuliaLang can be created using the DataFrame
type from the DataFrames
package.
using DataFrames
# Create a dataframe with 3 columns
df = DataFrame(A = [1,2,3], B = [4,5,6], C = [7,8,9])
# Print the dataframe
println(df)
3×3 DataFrame
│ Row │ A │ B │ C │
│ │ Int64 │ Int64 │ Int64 │
├─────┼───────┼───────┼───────┤
│ 1 │ 1 │ 4 │ 7 │
│ 2 │ 2 │ 5 │ 8 │
│ 3 │ 3 │ 6 │ 9 │
-
using DataFrames
: This imports theDataFrames
package which contains theDataFrame
type. -
df = DataFrame(A = [1,2,3], B = [4,5,6], C = [7,8,9])
: This creates aDataFrame
object with 3 columns,A
,B
andC
, and 3 rows of data. -
println(df)
: This prints theDataFrame
object to the console.
onelinerhub: How to create dataframes in JuliaLang?