ncol in julia
In Julia, to get the number of columns in a matrix or DataFrame, you can use the ncol
function. Here's an example:
using DataFrames
# Create a DataFrame
df = DataFrame(A = 1:5, B = 6:10, C = 11:15)
# Get the number of columns
num_cols = ncol(df)
# Print the result
println("Number of columns: ", num_cols)
This will output the number of columns in the DataFrame df
.