- Learning pandas(Second Edition)
- Michael Heydt
- 201字
- 2021-07-02 20:37:08
Creating a Series using Python lists and dictionaries
A Series can be created from a Python list:

The first column of numbers represents the label in the index of the Series. The second column contains the values. dtype: int64 denotes that the data type of the values in the Series is int64.
By default, pandas will create an index consisting of consecutive integers starting at 0. This makes the series look like an array in many other programming languages. As an example, we can look up the value at label 3:

Data types other than integers can be used. The following creates a series of string values:

To create a series consisting of a sequence of n identical values v, use the Python shorthand for list creation, [v]*n. The following creates five values of 2:

A similar type of shorthand is the following, which uses the Python shorthand to use each character as a list item:

A Series can be directly initialized from a Python dictionary. When using a dictionary, the keys of the dictionary are used as the index labels:

- C#高級編程(第10版) C# 6 & .NET Core 1.0 (.NET開發經典名著)
- Android Application Development Cookbook(Second Edition)
- 匯編語言程序設計(第2版)
- SQL Server 2016數據庫應用與開發習題解答與上機指導
- 微信小程序入門指南
- Mastering JavaScript High Performance
- PLC應用技術(三菱FX2N系列)
- HTML5+CSS3 Web前端開發技術(第2版)
- UML2面向對象分析與設計(第2版)
- 從零開始學Android開發
- Android技術內幕(系統卷)
- Mastering Bootstrap 4
- Qt 5.12實戰
- ANSYS FLUENT 16.0超級學習手冊
- R語言數據分析從入門到實戰