Pandas data type of the field name is not specified, reads the corresponding fields

 

 

 

# Result here date returns the minimum, maximum date, but no column name, the result of the latter form of writing is not the same return 
Grouped = df.groupby (by = [ ' the userid ' ]). Orderdate.agg ([ ' min ' , ' max ' ])   

a=type(grouped['min']==grouped['max'])
b=type(grouped.min==grouped.max)
C = type (grouped.min)
 Print ( " A data type: " , A)
 Print ( " B data type: " , B)
 Print ( " C data type: " , C)

 

 

 

 

 

= df.groupby Grouped (by = [ ' the userid ' .]) orderdate.agg ([ ' min ' , ' max ' .]) the rename (Columns = ({ ' min ' : ' minimum ' , ' max ' : ' maximum value ' }))
A = type (Grouped [ ' Min ' ] == Grouped [ ' maximum ' ])
B = type (Grouped. minimum == Grouped. maximum)
C = type (Grouped. Min)

Print ( " A data type: " , A)
 Print ( " B data type: " , B)
 Print ( " C data type: " , C)

operation result:

Guess you like

Origin www.cnblogs.com/bravesunforever/p/12142832.html