必要的 Pandas 基本功能

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: 我们将在这里讨论许多关于pandas数据结构的基础功能。这里展示的是如何创建一些在签一个章节的实例中使用到的对象:

  1. In [1]: index = pd.date_range('1/1/2000', periods=8)
  2. In [2]: s = pd.Series(np.random.randn(5), index=['a', 'b', 'c', 'd', 'e'])
  3. In [3]: df = pd.DataFrame(np.random.randn(8, 3), index=index,
  4. ...: columns=['A', 'B', 'C'])
  5. ...:
  6. In [4]: wp = pd.Panel(np.random.randn(2, 5, 4), items=['Item1', 'Item2'],
  7. ...: major_axis=pd.date_range('1/1/2000', periods=5),
  8. ...: minor_axis=['A', 'B', 'C', 'D'])
  9. ...: