- 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:

- R語言經典實例(原書第2版)
- 深度學習經典案例解析:基于MATLAB
- QTP自動化測試進階
- SSM輕量級框架應用實戰
- 零基礎趣學C語言
- 微信小程序全棧開發技術與實戰(微課版)
- Android Wear Projects
- Azure Serverless Computing Cookbook
- Mastering Elasticsearch(Second Edition)
- Webpack實戰:入門、進階與調優(第2版)
- Vue.js 3應用開發與核心源碼解析
- Java 9 Programming By Example
- Learning Python Data Visualization
- Redmine Cookbook
- Mastering Apache Camel