python建立数据库索引
介绍 (Introduction)
The Python and NumPy indexing operators [] and attribute operator ‘.’ (dot) provide quick and easy access to pandas data structures across a wide range of use cases. The index is like an address, that’s how any data point across the data frame or series can be accessed. Rows and columns both have indexes.
Python和NumPy索引运算符[]和属性运算符'。 (点)可在各种用例中快速轻松地访问熊猫数据结构。 索引就像一个地址,这就是如何访问数据帧或系列中的任何数据点。 行和列都有索引。
The axis labeling information in pandas objects serves many purposes:
pandas对象中的轴标签信息有许多用途:
- Identifies data (i.e. provides metadata) using known indicators, important for analysis, visualization, and interactive console display. 使用已知的指标标识数据(即提供元数据),这对于分析,可视化和交互式控制台显示很重要。
- Enables automatic and explicit data alignment. 启用自动和显式数据对齐。
- Allows intuitive getting and setting of subsets of the data set. 允许直观地获取和设置数据集的子集。
索引和选择数据的不同选择 (Different Choices for indexing and selecting data)
Object selection has had several user-requested additions to support more explicit location-based indexing. Pandas now support three types of multi-axis indexing for selecting data.
对象选择具有一些用户请求的添加项,以支持更明确的基于位置的索引。 熊猫现在支持三种类型的多轴索引来选择数据。
# import the pandas library and aliasing as pd import pandas as pd import numpy as np df = pd.DataFrame(np.random.randn(6, 3), index = ['a','b','c','d','e','f'], columns = ['A', 'B', 'C'])