Is there a way to slice columns in data frame when I want multiple consecutive columns? I also want to be able to slice the rows at the same time. The below example shows the call I would like to find an equivalent to.
import numpy as np
import pandas as pd
data = np.random.randn(10, 4)
df = pd.DataFrame(data, columns=['A', 'B', 'C', 'D'])
print(df.loc[1:5, ['A', 'B', 'C']]) # Works
# print(df.loc[1:5, ['A':'C']]) # Is there a syntax that allows this?