python 二维字典转矩阵
利用pandas模块
import pandas
books = {} books["auth1"] = {} books["auth2"] = {} books["auth1"]["humor"] = 20 books["auth1"]["action"] = 30 books["auth2"]["comedy"] = 20 from pandas import * df = pandas.DataFrame(books).T.fillna(0)
action comedy humor
auth1 30 0 20
auth2 0 20 0