`to_dataframe` method implements pandas.DataFrame export

Refactored the `broadcast_variables` function and fixed a bug in
`variable.transpose` (see the new test case).