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

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -