Skip to content

Commit

Permalink
Ordering columns in the Druid pandas df
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Jan 11, 2016
1 parent 6c92fa4 commit 4aa70d0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ List of TODO items for Panoramix
## Features
* **URL shortner**
* **Dashboard URL filters:** `{dash_url}#fltin__fieldname__value1,value2`
* **Browser history in explore.html:** use location.hash to manage query history
* **Default slice:** choose a default slice for the dataset instead of default endpoint
* **refresh freq**: specifying the refresh frequency of a dashboard and specific slices within it, some randomization would be nice
* **Color hash in JS:** it'd be nice to use the same hash function for color attribution of series
Expand Down
9 changes: 9 additions & 0 deletions panoramix/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -916,6 +916,15 @@ def query(
client.groupby(**qry)
query_str += json.dumps(client.query_dict, indent=2)
df = client.export_pandas()

# Reordering columns
cols = []
if 'timestamp' in df.columns:
cols += ['timestamp']
cols += [col for col in groupby if col in df.columns]
cols += [col for col in metrics if col in df.columns]
cols += [col for col in df.columns if col in cols]
df = df[cols]
return QueryResult(
df=df,
query=query_str,
Expand Down

0 comments on commit 4aa70d0

Please sign in to comment.