Reputation: 7273
I have a set of values: false.csv
I have index values as:
Time
2019.01.02 06:01:00
2019.01.02 06:09:00
2019.01.02 06:12:00
2019.01.02 06:19:00
2019.01.02 06:21:00
2019.01.02 06:26:00
2019.01.02 06:44:00
I want to set the values to zero for the above index which are in separate file. I tried to load the data but could not get the path to move forward.
here is the way I loaded data:
import pandas as pd
df = pd.read_csv("false.csv")
df1= pd.read_csv("set.csv")
Let me know how I can move forward.
Upvotes: 0
Views: 47
Reputation: 25895
First, when you load the false
file make sure your index is by date:
df = pd.read_csv("false.csv",index_col=0)
df1= pd.read_csv("set.csv")
Next, just set what you need to 0:
df.loc[df1['Time']] = 0
loc
matches indices, rather than titles.
Upvotes: 1