+1 vote
How can I sort a dataset in the Analyze section over a column?
asked by Simon

3 Answers

+2 votes
Best answer
  • In your Dataset choose Actions > Python > Recipee
  • Add a new Output Dataset in  the modal window

  • Copy and adapt the following code snippet
# -*- coding: utf-8 -*-
import dataiku
import pandas as pd, numpy as np
from dataiku import pandasutils as pdu

# Input datasets
input_dataset = dataiku.Dataset("Input_dataset")
input_dataset_df = input_dataset.get_dataframe()
sorted_dataset = input_dataset_df.sort(["column_i_want_to_sort"], ascending=[0])

# Output datasets
output_dataset = dataiku.Dataset("Output_dataset")
  • Run the script, boom your column is sorted \o/


answered by
selected by
0 votes
Hi Simon,

This is not possible to sort a dataset in an Analyze section or a visual preparation recipe. It might me available in a future release.
However, you can sort a dataset with a Python/R/SQL recipe.
answered by
0 votes
Starting with DSS 4.0 you can sort values of your sample in the preview. Click on the header of a column and select sort.

Note that if you want to write out a sorted dataset, the selected answer is still the way to go.
answered by
528 questions
547 answers
309 users