Answers for "python pandas how to select range of data"

0

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])
Posted by: Guest on May-13-2021

Code answers related to "python pandas how to select range of data"

Python Answers by Framework

Browse Popular Code Answers by Language