Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the Series-like operation in 2D dataframe

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article will explain in detail about the two-dimensional dataframe class Series operation is how, the content of the article is of high quality, so the editor to share with you to do a reference, I hope you have a certain understanding of the relevant knowledge after reading this article.

Introduction to pandas

Pandas is one of the most classic libraries in the field of python data analysis, which is based on numpy.

The data structures commonly used in pandas are:

1century Series: an one-dimensional array with index. Only data of the same type is allowed to be stored in Series.

2Magna DataFrame: two-dimensional tabular data structure. You can think of DataFrame as a container for Series.

3Jing Panel: a three-dimensional array. Can be understood as a container of DataFrame.

Did you find the relationship between the name of the pandas library and the names of these three data structures? We introduce DataFrame in this section and the following sections. DataFrame is the most widely used data structure of python in the field of data analysis. It has the following advantages:

The data is intuitive-it's like an excel table.

Powerful-extremely rich methods

The summary of DataFrame is as follows:

DataFrame is a Series container that is created and indexed much like Series.

DataFrame can be thought of as an array with index and columns names and supports vectorization.

You can manipulate DataFrame like an excel table: insert rows and columns, sort, filter...

You can manipulate DataFrame in the same way as SQL tables: query, group, join...

In this section, we introduce the Series-like operation of DataFrame.

First, create a DataFrame

1. Type conversion method

2, file import method

3, column by column generation method

Second, the index of DataFrame

DataFrame's index is very similar to Series, supporting subscript index, label index and Boolean index (label refers to index or columns). This can usually be achieved in the following ways: square brackets [], period symbols, loc,iloc,ix. The most commonly used are square brackets, loc, and iloc.

1, select only rows

2, select only columns

3, select both rows and columns

4, Boolean index

On the two-dimensional dataframe class Series operation is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report