当我尝试使用to_string从a输出列时dataframe
,它会截断列的输出.
print gtf_df.ix[:1][['transcript_id','attributes']].to_string(header=False,index=False)
Out: ' CUFF.1.1 gene_id "CUFF.1"; transcript_id "CUFF.1.1"; FPKM '
print gtf_df.ix[:1]['attributes'][0]
Out: 'gene_id "CUFF.1"; transcript_id "CUFF.1.1"; FPKM "1670303.8168650887"; frac "1.000000"; conf_lo "0.000000"; conf_hi "5010911.450595"; cov "9658.694354";'
Run Code Online (Sandbox Code Playgroud)
有关如何解决此问题的任何想法?谢谢!
Wou*_*ire 11
默认情况下,使用__repr__
或to_string
列截断为50个字符.在早于0.13.1的Pandas版本中,可以使用pandas.set_printoptions()
以下方法控制:
In [64]: df
Out[64]:
A B
a this is a very long string, longer than the defau bar
b foo baz
In [65]: pandas.set_printoptions(max_colwidth=100)
In [66]: df
Out[66]:
A B
a this is a very long string, longer than the default max_column width bar
b foo baz
Run Code Online (Sandbox Code Playgroud)
在更新版本的Pandas中,请改用:
pd.options.display.max_colwidth = 100
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7314 次 |
最近记录: |