Youtube Video commentary is also available.
P-021: Count the number of receipt details data frame (df_receipt).
code
len(df_receipt)
output
104681
**-This is a method to count the number of rows in Pandas DataFrame / Series. -Use when you want to check how many lines there are in total. ** **
** * There are other functions that are often used when you want to check the number of rows and columns **
--Summary display of information such as the number of rows and columns
code
df_receipt.info()
output
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 104681 entries, 0 to 104680
Data columns (total 9 columns):
 #   Column          Non-Null Count   Dtype 
---  ------          --------------   ----- 
 0   sales_ymd       104681 non-null  int64 
 1   sales_epoch     104681 non-null  int64 
 2   store_cd        104681 non-null  object
 3   receipt_no      104681 non-null  int64 
 4   receipt_sub_no  104681 non-null  int64 
 5   customer_id     104681 non-null  object
 6   product_cd      104681 non-null  object
 7   quantity        104681 non-null  int64 
 8   amount          104681 non-null  int64 
dtypes: int64(6), object(3)
memory usage: 7.2+ MB
--Display the number of columns
code
len(df_receipt.columns)
output
9
--Displays the number of rows and columns
code
df_receipt.shape
output
(104681, 9)
--Displays the total number of elements (size)
code
df_receipt.size
output
942129
        Recommended Posts