【发布时间】:2017-05-18 23:27:30
【问题描述】:
关于如何将列设置为显示的行,从而在 pandas 中将行显示为列的任何想法?
当前打印数据框会输出如下内容:
K T best_testing_rmse best_training_rmse chan_out_dim \
48 15 20000 1.24502685 1.24942538 15
217 15 20000 1.25521732 1.24871174 15
dropout_p g_hid g_in g_latent g_rij \
48 0.1 tanh elu linear sigmoid
217 0.1 tanh elu linear sigmoid
harvest_dir hid_dim input_dropout_p \
48 ./harvest_autorec_20170103_175735 50 0.1
217 ./harvest_autorec_20170103_175730 50 0.1
last_testing_rmse last_training_rmse lr max_epoch \
48 1.52006088 1.52138316 0.000002 1403
217 1.31366942 1.30483602 0.000002 1056
minibatch_size n_epochs n_hid_layers optimizer preprocessing_type \
48 1 20000 1 gpu_omp zscore
217 1 20000 1 gpu_omp zscore
regression_error_coef regression_type regularization_lambda \
48 0.5 item 0.001
217 0.5 item 0.001
regularization_latent_kl stochastic_prediction upd
48 0.5 False adam_symbolic
217 0.5 False adam_symbolic
这特别不方便。这张旋转 90 度的桌子更好看。
【问题讨论】:
-
对不起,你问如何转置?例如
df.T? -
如果你想要一列中的所有内容,你可以使用
df.stack() -
@EdChum :谢谢,这正是我所需要的!
标签: python python-3.x pandas dataframe pretty-print