从Pandas Dataframe打印中删除页眉和页脚 [英] Remove Header and Footer from Pandas Dataframe print
本文介绍了从Pandas Dataframe打印中删除页眉和页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
以下代码打印我想要的所有值,但具有日期"作为第一行,最后一行是名称:关闭,长度:1828,dtype:float64"
The following code prints all the values I want but has "Date" as the first row and "Name: Close, Length: 1828, dtype: float64" as the last row
import pandas as pd
from pandas.io.data import DataReader
from datetime import datetime
ibm = DataReader('IBM', 'yahoo', datetime(2009,1,1))
pd.set_option('display.max_rows',len(ibm))
print ibm["Close"]
如何在第一行日期"行和最后一行名称:关闭,长度:1828,dtype:float64"行中不打印数据?切片不起作用,我尝试过打印ibm ["Close"] [1:-1],它只是切断了第二行和第二行到最后一行.
How do I print the data w/o this first "Date" line and the last "Name: Close, Length: 1828, dtype:float64" line? Slicing doesn't work, I've tried print ibm["Close"][1:-1] and it just cuts off the 2nd and 2nd to last row.
推荐答案
print ibm["Close"].to_string(header=False)
这篇关于从Pandas Dataframe打印中删除页眉和页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文