Questions tagged [shift]

Questions related to the usage of the right and/or left shift key on the keyboard. For questions regarding bitwise shift operations use [bit-shift]

Questions related to the usage of the right and/or left Shift key on the keyboard. For questions regarding bitwise shift operations use

1054 questions
4
votes
3 answers

numpy array equivalent of pandas.shift() function?

I have an array [False False False ... True True True] I want to check if the previous value == current value. In pandas, I can use something like... np.where(df[col name].shift(1).eq(df[col name]), True, False) I tried using scipy shift…
JPWilson
  • 691
  • 4
  • 14
4
votes
3 answers

Using R data table to calculate strike rates over cumulative dates

I have a data table structure of about 1.5 M rows and hundreds of columns, representing dates with horse racing results - this is to be used for a predictive model, but first feature engineering is necessary to calculate strike rates of various…
user1849286
  • 179
  • 1
  • 10
4
votes
1 answer

How to move every element in a column by n range in a dataframe using python?

I have a dataframe df that looks like below: No A B value 1 23 36 1 2 45 23 1 3 34 12 2 4 22 76 NaN ... I would like to shift each of the value in "value" column by 2. And the first row "value" should not be shifted. I…
hakuna_code
  • 783
  • 7
  • 16
4
votes
7 answers

why can't you shift a uint16_t

I am trying to fill a 64-bit unsigned variable by combining 16-bit and 8-bit values: uint8_t byte0 = 0x00; uint8_t byte1 = 0xAA; uint8_t byte2 = 0x00; uint8_t byte3 = 0xAA; uint16_t hword0 = 0xAA00; uint16_t hword1 = 0xAAAA; uint64_t result = (…
Sajesh S F
  • 53
  • 1
  • 4
4
votes
2 answers

React - Select multiple checkboxes holding Shift key

I have a list of checkboxes in my React App. When I hold Shift key and click one - the others between current and the nearest checked one should become selected. For now I'm tring to do somethimg like this:
Anna
  • 2,911
  • 6
  • 29
  • 42
4
votes
1 answer

WPF ContextMenu using (Shift-Right-Click)

I have a question with the "ContextMenu" in WPF. Is there a way to have the context menu pop up only if a "Shift-Right-Click" was performed?? I have been looking all over the place for this. The ContextMenu seems to only be able to pop up when a…
zezba9000
  • 3,247
  • 1
  • 29
  • 51
4
votes
2 answers

Shifting certain rows to the left in pandas dataframe

I have a pandas database of some sports data. The columns are name, age, birth city, birth country, rookie, weight, and problem. The original data had birthcity as "City,State" for American players, so when I used a comma delimiter the result was…
JayBee
  • 133
  • 1
  • 5
4
votes
4 answers

Pandas apply, but access previously calculated value

Suppose I have a DataFrame (or Series) like this: Value 0 0.5 1 0.8 2 -0.2 3 None 4 None 5 None I wish to create a new Result column. The value of each result is determined by the previous Value, via an arbitrary function…
gberger
  • 2,813
  • 3
  • 28
  • 50
4
votes
1 answer

Haxe+OpenFL->Neko, MouseEvent.xxxKey always false

I am making a game using Haxe+OpenFL. I had targeted js once ago, then I switched to neko and the following construction stopped working: if(e.shiftKey) do smth Ofc I've not changed this block of code, nor context since changing the target. What…
Gulvan
  • 305
  • 2
  • 12
4
votes
3 answers

How do I lag a data.frame?

I'd like to lag whole dataframe in R. In python, it's very easy to do this, using shift() function (ex: df.shift(1)) However, I could not find any as an easy and simple method as in pandas shift() in R. How can I do this? > x =…
Wookeun Lee
  • 463
  • 1
  • 6
  • 18
4
votes
4 answers

Best way to shift a list in Python?

I have a list of numbers, let's say : my_list = [2, 4, 3, 8, 1, 1] From this list, I want to obtain a new list. This list would start with the maximum value until the end, and I want the first part (from the beginning until just before the maximum)…
user7320967
4
votes
1 answer

iOS: Pitch Shifting & Piping output from OpenAL into a buffer

I have recently spotted that it is possible in iOS to use OpenAL to pitch shift. I am looking at Hollance's sound bank player. it takes in 15 or so piano notes spattered through the range, and plays any note by figuring out which sample it is…
P i
  • 29,020
  • 36
  • 159
  • 267
4
votes
1 answer

How can I find start and end occurrence of character in Python

I have a dataframe df with the following ids (in Col). The last occurrence of A/B/C represents the start, and the last occurrence of X is the end. I should ignore any other A,B,C between start and end (e.g. rows 8 and 9). I have to find start and…
ckp
  • 579
  • 2
  • 10
  • 27
4
votes
4 answers

C++ shift left with big value

I'm wonder how to shift left value in C++. For example: 1 << 180 and I beleve that result of that should be: 1532495540865888858358347027150309183618739122183602176 (tested in python [1 << 180]);
Robert
  • 338
  • 5
  • 16
4
votes
1 answer

Adding multiple constraints at once in Xcode 7

In previous versions of Xcode you could drag from one UI element in your storyboard to another and by holding the Shift button pressed, you could add more constraints between those two components - all at once. In Xcode 7 this doesn't seem to…
kanstraktar
  • 5,357
  • 2
  • 21
  • 29