I have a dataFrame and I want a range of specific rows and at the same time a range that is composed of a continuous range of columns plus an additional one. Included is a piece of code that produces such a dataFrame
import pandas as pd
import numpy as np
np.random.seed(5)
dF = pd.DataFrame(np.random.randint(100, size=(100, 6)),
columns=list('ABCDEF'),
index=['R{}'.format(i) for i in range(100)])
dF.head()
This works fine:
dF.loc[:, 'C':'E']
But I need something like this, that produces an error:
dF.loc['R95':, ['A':'C', 'F']]
The expected result has to include from row 'R95' onwards and columns 'A', 'C' and 'F'
dF.loc['R95':, ['C','D', 'F']]considering "The expected result has to include from row 'R95' onwards and columns 'C', 'D' and 'F'"