I have created a datatable frame as,
DT_EX = dt.Frame({'sales':[103.07, 47.28, 162.15, 84.47, 44.97, 46.97, 34.99, 9.99, 29.99, 64.98],
'quantity':[6, 2, 8, 3, 3, 3, 1, 1, 1, 2],
'customer_lifecycle_status':['Lead','First time buyer','Active customer','Defecting customer','
'Lead','First time buyer','Lead','Lead','Lead','Lead']})
Now I'm trying to select only 2 fields from the datatable as,
DT_EX[:, f.sales, f.quantity]
In this case, It is displaying the data from quantity to sales whereas it should display them in the specified order(sales,quantity). and here another observation from this output is that- quantity fields gets sorted in an ascending order.
Keeping this case a side, Now I have tried to pass the required fields in parenthesis as
DT_EX[:, (f.sales,f.quantity)]
Here It is now producing the correct output without any sorting/jumbled of fields
It's always recommended to pass the fields to be selected in parenthesis.
Finally, I would be interested to know what has happened in the first case? , would you please explain it clearly ?.