pandas time series pivot -


i have time series of financial data in pandas dataframe in tidy format currently. have 1 datapoint per row, , data includes: 1 date 2 country (us, uk, or japan) 3 sector (tech, industrials, consumer, health_care) 4 metric (count_of_stocks, total_market_cap, volatility, etc) 5 value

the data in "long format" -- 5 columns wide. i'd pivot have each date represented 1 row multi-index. each of 3 regions has same 4 sectors , 5 metrics, expect resulting dataframe 60 columns wide.

i've been struggling figure out how set multi-index , pivot/unstack it. don't mind if resulting dataframe has either multi-index (with top 3 rows tree)or has 1 index row names us_indus_autos_count, etc.

any appreciated. in advance


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -