danfo.DataFrame.column(col_name) [source]
Parameters | Type | Description | Default |
col_name | Str | The name of a column in the DataFrame | |
Returns:
return Series
const dfd = require("danfojs-node")let data = [{ "Name": ["Apples", "Mango", "Banana", undefined] },{ "Count": [NaN, 5, NaN, 10] },{ "Price": [200, 300, 40, 250] }]let df = new dfd.DataFrame(data)df.column("Name").print()//Alternatively, you can retrieve columns by using the object propertydf['Name'].print() //produces the same result as above
╔═══╤══════════════════════╗║ │ Name ║╟───┼──────────────────────╢║ 0 │ Apples ║╟───┼──────────────────────╢║ 1 │ Mango ║╟───┼──────────────────────╢║ 2 │ Banana ║╟───┼──────────────────────╢║ 3 │ NaN ║╚═══╧══════════════════════╝╔═══╤══════════════════════╗║ │ Name ║╟───┼──────────────────────╢║ 0 │ Apples ║╟───┼──────────────────────╢║ 1 │ Mango ║╟───┼──────────────────────╢║ 2 │ Banana ║╟───┼──────────────────────╢║ 3 │ NaN ║╚═══╧══════════════════════╝
To select more than one column with specific rows, you can use any of the following: DataFrame.loc, DataFrame.iloc or DataFrame.query