Julia is a powerful programming language for complex computational analysis in machine learning and data science.
DataFrames are 2D data structures that help organize data into a table with distinct rows and columns.
There are two ways to obtain the number of rows in a DataFrame in Julia.
Using the nrow()
function
Using the size()
function
nrow()
functionThe nrow()
function obtains the total number of rows present.
nrow(dataframe)
using DataFramesdf = DataFrame(student_id=[1,2,3,4,5],name = ["Amy","Jane","John","Nancy","Peter"],marks=[50,60,70,98,30],age=[15,20,18,19,15])println(nrow(df))
DataFrames
for use.size()
functionThe size()
function helps obtain a dataset’s number of columns and rows. To get the number of rows, specify 1
inside or outside the function, as shown in the syntax below.
size(dataframe,1)
size(dataframe)[1]
using DataFramesdf = DataFrame(student_id=[1,2,3,4,5],name = ["Amy","Jane","John","Nancy","Peter"],marks=[50,60,70,98,30],age=[15,20,18,19,15])println(size(df,1))println(size(df)[1])
size()
function.Free Resources