8. Essential Basic Functionality
Essential Basic Functionality
Here we discuss a lot of the essential functionality common to the pandas data structures. Here’s how to create some of the objects used in the examples from the previous section:
In [1]: index = pd.date_range('1/1/2000', periods=8) In [2]: s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e']) In [3]: df = pd.DataFrame(np.random.randn(8, 3), index=index, ...: columns=['A', 'B', 'C']) ...: In [4]: wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'], ...: major_axis=pd.date_range('1/1/2000', periods=5), ...: minor_axis=['A', 'B', 'C', 'D']) ...:
Head and Tail
To view a small sample of a Series or DataFrame object, use the 登录查看完整内容