728x90
In [1]:
import pandas as pd
In [3]:
# data
client_df = pd.DataFrame({'Client ID':[111, 112, 113, 114],
'Client Name':['Michael','Donald','John','Matthew'],
'Net Worth[$]': [3000, 40000, 100000, 15000],
'Years': [5, 9, 10, 12]})
client_df
Out[3]:
Client ID | Client Name | Net Worth[$] | Years | |
---|---|---|---|---|
0 | 111 | Michael | 3000 | 5 |
1 | 112 | Donald | 40000 | 9 |
2 | 113 | John | 100000 | 10 |
3 | 114 | Matthew | 15000 | 12 |
In [4]:
# the data type
type(client_df)
Out[4]:
pandas.core.frame.DataFrame
In [5]:
# View the first couple of rows
client_df.head(2)
Out[5]:
Client ID | Client Name | Net Worth[$] | Years | |
---|---|---|---|---|
0 | 111 | Michael | 3000 | 5 |
1 | 112 | Donald | 40000 | 9 |
In [6]:
# View the last couple of rows
client_df.tail(1)
Out[6]:
Client ID | Client Name | Net Worth[$] | Years | |
---|---|---|---|---|
3 | 114 | Matthew | 15000 | 12 |
In [7]:
# the shape of the DataFrame (rows,columns)
client_df.shape
Out[7]:
(4, 4)
In [8]:
# DataFrame information
client_df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4 entries, 0 to 3
Data columns (total 4 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Client ID 4 non-null int64
1 Client Name 4 non-null object
2 Net Worth[$] 4 non-null int64
3 Years 4 non-null int64
dtypes: int64(3), object(1)
memory usage: 256.0+ bytes
728x90
'Data Analytics with python > [Data Analysis]' 카테고리의 다른 글
[Pandas][DataFrame]S2_03_Outputs (0) | 2023.01.21 |
---|---|
[Pandas][DataFrame]S2_02_Inputs (0) | 2023.01.21 |
[Pandas][Series]S1_12_Slicing (0) | 2023.01.17 |
[Pandas][Series]S1_11_Indexing (0) | 2023.01.17 |
[pandas][Series]S1_10_Checking element (0) | 2023.01.17 |
댓글