I have a dataframe with a periodicity in the rows of 14 i.e. there are 14 lines of data per record (means, sdev etc.) and I want to extract the 2nd, 4th, 7th and 9th line, repeatedly for every record (14 lines). My code is:
Mean_df = df.iloc[[1,3,6,8]::14,:].copy()
which does not work
TypeError: cannot do slice indexing on <class 'pandas.core.indexes.range.RangeIndex'> with these indexers [[1, 3, 6, 8]] of <class 'list'>
I got help with the code from here, which has been useful, but not on the multi-row selections -- Pandas every nth row
I can extract as several different slices and combine, but it feels like there may be a more elegant solution.
Any ideas?