I am creating a new pandas dataframe from a previous dataframe using the .groupby and .size methods.
.groupby
.size
[in] results = df.groupby([\"
you can use as_index=False parameter for the .groupby() function:
as_index=False
.groupby()
results = df.groupby(["X", "Y", "Z", "F"], as_index=False).size().rename(columns={0:'Count'})