小编Brn*_*ndn的帖子

如何阻止我的熊猫数据表在打印时被截断?

我编写了读取两个字符串的代码,然后将它们比较相似的单词。然后产生一个带有数据的表格。

我的问题是它不断分裂为两个。我需要对此进行纠正,以便能够将其合并到HTML中。我将不胜感激,在此先感谢您!:)

我也尝试只打印第一行。

第一排

完整代码:

import string
from os import path

import pandas as pd
pd.set_option('display.max_columns', None) #prevents trailing elipses
pd.set_option('display.max_rows', None)
import os.path

BASE = os.path.dirname(os.path.abspath(__file__))

file1 = open(os.path.join(BASE, "samp.txt"))
sampInput=file1.read().replace('\n', '')
file2 = open(os.path.join(BASE, "ref.txt"))
refInput=file2.read().replace('\n', '')

sampArray = [word.strip(string.punctuation) for word in sampInput.split()]
refArray = [word.strip(string.punctuation) for word in refInput.split()]

out=pd.DataFrame(index=sampArray,columns=refArray)

for i in range(0, out.shape[0]): #from 0 to total number of rows
        for word in refArray: #for each word in the samplearray

                df1 = out.iloc[0, 0:16].copy()
                top …
Run Code Online (Sandbox Code Playgroud)

python django dataframe pandas python-3.7

5
推荐指数
1
解决办法
1834
查看次数

标签 统计

dataframe ×1

django ×1

pandas ×1

python ×1

python-3.7 ×1