I have a pandas.DataFrame of the form. I'll show you a simple example.(In reality, it consists of hundreds of millions of rows of data.). I want to measure Gaussian fit and FWHM for DIFF after grouping by ID.
df =
X ID diff
1 52 11.0
12 85 -102.0
17 42 43.0
18 2 81.0
59 122 -10.0
78 21 -43.0
96 144 -6.0
101 76 -56.0
113 119 -75.0
120 82 4.0
134 83 11.0
139 39 16.0
152 12 -61.0
169 139 -124.0
170 37 26.0
173 35 -190.0
185 103 -64.0
192 122 -72.0
193 108 51.0
195 88 -30.0
199 43 -100.0
209 89 -154.0
243 32 94.0
246 138 -25.0
250 50 2.0
258 53 167.0
261 42 -23.0
272 69 -64.0
276 95 -14.0
279 25 -115.0
286 79 -65.0
288 82 2.0
332 43 213.0
- What do I do after "df[['ID','diff']].groupby(['ID'])" ?
- In fact, 'ID' ranges from 1 to 144.
- A graph image is not essential.
- I only need the result value.
- The above example is some data out of the whole.