Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python pandas how to select range of data

import numpy as np
import pandas as pd

df = pd.DataFrame(np.random.random((200,3)))
df['date'] = pd.date_range('2000-1-1', periods=200, freq='D')
mask = (df['date'] > '2000-6-1') & (df['date'] <= '2000-6-10')
print(df.loc[mask])
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #python #pandas #select #range #data
ADD COMMENT
Topic
Name
6+7 =