pandas info
时间: 2023-06-29 08:19:58 浏览: 45
Pandas is a popular data manipulation library for Python. The `info()` method is used to print a concise summary of a pandas DataFrame. It prints information about the DataFrame such as the index data type, column data types, non-null values, and memory usage. Here's an example:
```python
import pandas as pd
# create a sample DataFrame
data = {'Name': ['John', 'Jane', 'Alice', 'Bob'],
'Age': [25, 30, 35, 40],
'Salary': [50000, 60000, 70000, 80000]}
df = pd.DataFrame(data)
# print DataFrame info
df.info()
```
Output:
```
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4 entries, 0 to 3
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 4 non-null object
1 Age 4 non-null int64
2 Salary 4 non-null int64
dtypes: int64(2), object(1)
memory usage: 224.0+ bytes
```
In this example, `info()` method displays the number of rows in the DataFrame (4), the names of the columns (Name, Age, and Salary), the number of non-null values in each column (4), the data type of each column (object, int64), and the memory usage of the DataFrame (224.0+ bytes).