I have the following dataset:
Name Year Date Value
x year1 date1 v1
x year1 date2 v2
x year1 date3 v3
x year2 date1 v4
x year2 date2 v5
x year2 date3 v6
z year1 date1 v7
z year1 date2 v8
z year1 date3 v9
z year2 date1 v10
z year2 date2 v11
z year2 date3 v12
y year1 date1 v13
y year1 date2 v14
y year1 date3 v15
y year2 date1 v16
y year2 date2 v17
y year2 date3 v18
I would like the following dataset output:
Name Year Date Value
x year1 date1 v1
x year2 date1 v4
x year1 date2 v2
x year2 date2 v5
x year1 date3 v3
x year2 date3 v6
z year1 date1 v7
z year2 date1 v10
z year1 date2 v8
z year2 date2 v11
z year1 date3 v9
z year2 date3 v12
y year1 date1 v13
y year2 date1 v16
y year1 date2 v14
y year2 date2 v17
y year1 date3 v15
y year2 date3 v18
I tried the following code but my 'Name' column is sorting the x,y,z as well. I want the 'Name' column order to stay as x,z,y:
df.sort_values(['Name', 'Date'])