2

I have a series (business_day) which was generated via isin in order to create the series with dtype: bool:

Series: 0 True
1 True
2 True
...
563 False
566 False
Name: Date, dtpye: bool

I then tried to update another array by using:

myArray.ix[business_day]

and

myArray.loc[business_day]

where

myArray:
DataFrame: Date Epoch Value
0 2016-05-17 2016-05-17 11:30:00 12345
1 2016-05-17 2016-05-17 11:31:00 6789.7
2 2016-05-17 2016-05-17 11:32:00 123.45

The aim is to modify only myArray whereby the lines are "True" as per the business_day series. However the code used above has no effect. Where am I going wrong here?

2
  • What do you mean by no effect (assuming you did assign the result of myArray.loc[business_day] to some variables as it doesn't work in_place)? if you print myArray.loc[business_day], does it show the same number of rows as before? Commented Jun 17, 2016 at 15:26
  • Exactly: the same number of rows therefore the line of code above (myArray.loc[business_day]) made no difference. Commented Jun 17, 2016 at 15:33

1 Answer 1

1

Assign the result as it doesn't modify the original DataFrame:

myarray = myarray.loc[business_day] 
Sign up to request clarification or add additional context in comments.

3 Comments

Such a dumb mistake...yes it did the trick! Thanks, enjoy the weekend.
Which one? The .values shouldn't be necessary.
Ok added back to the answer for completeness. glad it was helpful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.