From 7ad112490aeccde55ae3c649c0b8601dac536240 Mon Sep 17 00:00:00 2001 From: Allen Riddell Date: Thu, 26 Mar 2015 15:55:13 -0400 Subject: [PATCH] Fit pandas table into allowed width. Closes #10 --- source/topic_model_python.rst | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/source/topic_model_python.rst b/source/topic_model_python.rst index 0c712c0..1e6f9b5 100644 --- a/source/topic_model_python.rst +++ b/source/topic_model_python.rst @@ -166,14 +166,18 @@ Now we will average those topic shares associated with the same novel together import pandas as pd OUTPUT_HTML_PATH = os.path.join('source', 'generated') rownames = sorted(set(novel_names)) - colnames = ["NMF Topic " + str(i + 1) for i in range(doctopic.shape[1])] - html = pd.DataFrame(np.round(doctopic, 2), index=rownames, columns=colnames).to_html() + colnames = ["NMF Topic " + str(i + 1) for i in range(doctopic.shape[1])][0:15] + html = pd.DataFrame(np.round(doctopic[:,0:15], 2), index=rownames, columns=colnames).to_html() with open(os.path.join(OUTPUT_HTML_PATH, 'NMF_doctopic.txt'), 'w') as f: f.write(html) .. raw:: html :file: generated/NMF_doctopic.txt +In order to fit into the space available, the table above displays the first 15 +of 20 topics. + + Inspecting the NMF fit ======================