Choosing non repetitive values in dataframe columns Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!How do I sort a dictionary by value?How to sort a dataframe by multiple column(s)Selecting multiple columns in a pandas dataframeRenaming columns in pandasAdding new column to existing DataFrame in Python pandasDelete column from pandas DataFrame by column name“Large data” work flows using pandasHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headers
How would you say "es muy psicólogo"?
Would color changing eyes affect vision?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Trying to understand entropy as a novice in thermodynamics
Why are vacuum tubes still used in amateur radios?
What would you call this weird metallic apparatus that allows you to lift people?
Show current row "win streak"
What does this say in Elvish?
Google .dev domain strangely redirects to https
How to write capital alpha?
As a dual citizen, my US passport will expire one day after traveling to the US. Will this work?
What is the "studentd" process?
Tannaka duality for semisimple groups
Is multiple magic items in one inherently imbalanced?
NERDTreeMenu Remapping
If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?
Why is std::move not [[nodiscard]] in C++20?
Can an iPhone 7 be made to function as a NFC Tag?
Random body shuffle every night—can we still function?
What does 丫 mean? 丫是什么意思?
How do living politicians protect their readily obtainable signatures from misuse?
Test print coming out spongy
A proverb that is used to imply that you have unexpectedly faced a big problem
Is there hard evidence that the grant peer review system performs significantly better than random?
Choosing non repetitive values in dataframe columns
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)
Data science time! April 2019 and salary with experience
The Ask Question Wizard is Live!How do I sort a dictionary by value?How to sort a dataframe by multiple column(s)Selecting multiple columns in a pandas dataframeRenaming columns in pandasAdding new column to existing DataFrame in Python pandasDelete column from pandas DataFrame by column name“Large data” work flows using pandasHow to iterate over rows in a DataFrame in Pandas?Select rows from a DataFrame based on values in a column in pandasGet list from pandas DataFrame column headers
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have the following dataframe.
import pandas as pd
dates = pd.date_range('20130101', periods=10)
df = pd.DataFrame([1,1,1,-1,-1,-1,1,1,-1,1], index=dates, columns=list('A'))
Expected output from df
df_out=pd.DataFrame([1,0,0,-1,0,0,1,0,-1,1], index=dates, columns=list('A'))
I want to choose alternate +1 and -1 and substitute zero when there is repetition.
df can be a big dataframe of 10 columns and I want this conversion on all the columns. What is the effective way without using for loop?
Please suggest the way forward. Thanking in anticipation.
python pandas dataframe
add a comment |
I have the following dataframe.
import pandas as pd
dates = pd.date_range('20130101', periods=10)
df = pd.DataFrame([1,1,1,-1,-1,-1,1,1,-1,1], index=dates, columns=list('A'))
Expected output from df
df_out=pd.DataFrame([1,0,0,-1,0,0,1,0,-1,1], index=dates, columns=list('A'))
I want to choose alternate +1 and -1 and substitute zero when there is repetition.
df can be a big dataframe of 10 columns and I want this conversion on all the columns. What is the effective way without using for loop?
Please suggest the way forward. Thanking in anticipation.
python pandas dataframe
1
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00
add a comment |
I have the following dataframe.
import pandas as pd
dates = pd.date_range('20130101', periods=10)
df = pd.DataFrame([1,1,1,-1,-1,-1,1,1,-1,1], index=dates, columns=list('A'))
Expected output from df
df_out=pd.DataFrame([1,0,0,-1,0,0,1,0,-1,1], index=dates, columns=list('A'))
I want to choose alternate +1 and -1 and substitute zero when there is repetition.
df can be a big dataframe of 10 columns and I want this conversion on all the columns. What is the effective way without using for loop?
Please suggest the way forward. Thanking in anticipation.
python pandas dataframe
I have the following dataframe.
import pandas as pd
dates = pd.date_range('20130101', periods=10)
df = pd.DataFrame([1,1,1,-1,-1,-1,1,1,-1,1], index=dates, columns=list('A'))
Expected output from df
df_out=pd.DataFrame([1,0,0,-1,0,0,1,0,-1,1], index=dates, columns=list('A'))
I want to choose alternate +1 and -1 and substitute zero when there is repetition.
df can be a big dataframe of 10 columns and I want this conversion on all the columns. What is the effective way without using for loop?
Please suggest the way forward. Thanking in anticipation.
python pandas dataframe
python pandas dataframe
asked Mar 22 at 11:54
Abhishek KulkarniAbhishek Kulkarni
1378
1378
1
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00
add a comment |
1
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00
1
1
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00
add a comment |
4 Answers
4
active
oldest
votes
IIUC you could use Series.diff
along with ne
to check which first differences are not 0
, or in other words, which subsequent values are not repeated, and replace those that are False
with 0
using DataFrame.where
:
df.where(df.A.diff().ne(0), 0)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
add a comment |
Try using np.where()
:
df.A=np.where(df.A.ne(df.A.shift()),df.A,0)
print(df)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
|
show 3 more comments
Try:
df['A'] = df['A'] * (df['A'].diff() != 0)
How this works:
diff()
calculates the difference between successive values in your series. If the diff is 0 then we know there was a repetition.
Therefore we can do a != 0
check which will create a boolean series which will be True wherever there was no repetition and false where there was a repetition.
Boolean series can be used as a series of zeroes and ones and multiplied against the original series resulting in zeroing out all the repetitions.
1
Added explanation!
– Nidal
Mar 22 at 12:56
add a comment |
A third option:
import pandas as pd
import numpy as np
def check_dup(data):
print(data)
if data[0] == data[1]:
return 0
else:
return data[1]
df = pd.DataFrame(np.random.randint(0,2, (10,1))*2-1)
df.rolling(window=2).apply(check_dup, raw=True)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299078%2fchoosing-non-repetitive-values-in-dataframe-columns%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
IIUC you could use Series.diff
along with ne
to check which first differences are not 0
, or in other words, which subsequent values are not repeated, and replace those that are False
with 0
using DataFrame.where
:
df.where(df.A.diff().ne(0), 0)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
add a comment |
IIUC you could use Series.diff
along with ne
to check which first differences are not 0
, or in other words, which subsequent values are not repeated, and replace those that are False
with 0
using DataFrame.where
:
df.where(df.A.diff().ne(0), 0)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
add a comment |
IIUC you could use Series.diff
along with ne
to check which first differences are not 0
, or in other words, which subsequent values are not repeated, and replace those that are False
with 0
using DataFrame.where
:
df.where(df.A.diff().ne(0), 0)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
IIUC you could use Series.diff
along with ne
to check which first differences are not 0
, or in other words, which subsequent values are not repeated, and replace those that are False
with 0
using DataFrame.where
:
df.where(df.A.diff().ne(0), 0)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
edited Mar 22 at 12:07
answered Mar 22 at 11:57
yatuyatu
16.7k41742
16.7k41742
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
add a comment |
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
1
1
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Slightly modified code of anky works too (df_out3=np.where(df.ne(df.shift()),0,df) but I chose yours.
– Abhishek Kulkarni
Mar 22 at 12:10
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
Glad it helped @AbhishekKulkarni Don't forget to upvote/accept if you found the answer useful, see What should I do when someone answers my question?, thanks!
– yatu
Mar 22 at 12:11
1
1
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
I thought I had accepted it. Slow internet made me look like uncivilized! Can't thank enough for everyone's time.
– Abhishek Kulkarni
Mar 22 at 12:20
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
No problem @AbhishekKulkarni you're welcome :)
– yatu
Mar 22 at 12:21
add a comment |
Try using np.where()
:
df.A=np.where(df.A.ne(df.A.shift()),df.A,0)
print(df)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
|
show 3 more comments
Try using np.where()
:
df.A=np.where(df.A.ne(df.A.shift()),df.A,0)
print(df)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
|
show 3 more comments
Try using np.where()
:
df.A=np.where(df.A.ne(df.A.shift()),df.A,0)
print(df)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
Try using np.where()
:
df.A=np.where(df.A.ne(df.A.shift()),df.A,0)
print(df)
A
2013-01-01 1
2013-01-02 0
2013-01-03 0
2013-01-04 -1
2013-01-05 0
2013-01-06 0
2013-01-07 1
2013-01-08 0
2013-01-09 -1
2013-01-10 1
edited Mar 22 at 11:59
answered Mar 22 at 11:56
anky_91anky_91
11.1k2922
11.1k2922
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
|
show 3 more comments
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
hmm yes but he wants alternate -1 and 1s
– yatu
Mar 22 at 11:58
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
@yatu okay, checking that, though i feel if op has duplicate values like example, this should also work
– anky_91
Mar 22 at 12:00
1
1
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
Yeah, not sure tbh. posted someth similarr
– yatu
Mar 22 at 12:01
1
1
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
Got an idea from your code (df_out=np.where(df.ne(df.shift()),0,df) )
– Abhishek Kulkarni
Mar 22 at 12:10
1
1
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
Done, @anky_91 !!!!!!!!!!!!!!!!!!!!!!!!!!
– Abhishek Kulkarni
Mar 22 at 14:17
|
show 3 more comments
Try:
df['A'] = df['A'] * (df['A'].diff() != 0)
How this works:
diff()
calculates the difference between successive values in your series. If the diff is 0 then we know there was a repetition.
Therefore we can do a != 0
check which will create a boolean series which will be True wherever there was no repetition and false where there was a repetition.
Boolean series can be used as a series of zeroes and ones and multiplied against the original series resulting in zeroing out all the repetitions.
1
Added explanation!
– Nidal
Mar 22 at 12:56
add a comment |
Try:
df['A'] = df['A'] * (df['A'].diff() != 0)
How this works:
diff()
calculates the difference between successive values in your series. If the diff is 0 then we know there was a repetition.
Therefore we can do a != 0
check which will create a boolean series which will be True wherever there was no repetition and false where there was a repetition.
Boolean series can be used as a series of zeroes and ones and multiplied against the original series resulting in zeroing out all the repetitions.
1
Added explanation!
– Nidal
Mar 22 at 12:56
add a comment |
Try:
df['A'] = df['A'] * (df['A'].diff() != 0)
How this works:
diff()
calculates the difference between successive values in your series. If the diff is 0 then we know there was a repetition.
Therefore we can do a != 0
check which will create a boolean series which will be True wherever there was no repetition and false where there was a repetition.
Boolean series can be used as a series of zeroes and ones and multiplied against the original series resulting in zeroing out all the repetitions.
Try:
df['A'] = df['A'] * (df['A'].diff() != 0)
How this works:
diff()
calculates the difference between successive values in your series. If the diff is 0 then we know there was a repetition.
Therefore we can do a != 0
check which will create a boolean series which will be True wherever there was no repetition and false where there was a repetition.
Boolean series can be used as a series of zeroes and ones and multiplied against the original series resulting in zeroing out all the repetitions.
edited Mar 22 at 13:11
answered Mar 22 at 12:01
NidalNidal
35029
35029
1
Added explanation!
– Nidal
Mar 22 at 12:56
add a comment |
1
Added explanation!
– Nidal
Mar 22 at 12:56
1
1
Added explanation!
– Nidal
Mar 22 at 12:56
Added explanation!
– Nidal
Mar 22 at 12:56
add a comment |
A third option:
import pandas as pd
import numpy as np
def check_dup(data):
print(data)
if data[0] == data[1]:
return 0
else:
return data[1]
df = pd.DataFrame(np.random.randint(0,2, (10,1))*2-1)
df.rolling(window=2).apply(check_dup, raw=True)
add a comment |
A third option:
import pandas as pd
import numpy as np
def check_dup(data):
print(data)
if data[0] == data[1]:
return 0
else:
return data[1]
df = pd.DataFrame(np.random.randint(0,2, (10,1))*2-1)
df.rolling(window=2).apply(check_dup, raw=True)
add a comment |
A third option:
import pandas as pd
import numpy as np
def check_dup(data):
print(data)
if data[0] == data[1]:
return 0
else:
return data[1]
df = pd.DataFrame(np.random.randint(0,2, (10,1))*2-1)
df.rolling(window=2).apply(check_dup, raw=True)
A third option:
import pandas as pd
import numpy as np
def check_dup(data):
print(data)
if data[0] == data[1]:
return 0
else:
return data[1]
df = pd.DataFrame(np.random.randint(0,2, (10,1))*2-1)
df.rolling(window=2).apply(check_dup, raw=True)
answered Mar 22 at 12:03
Jurgen StrydomJurgen Strydom
776415
776415
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55299078%2fchoosing-non-repetitive-values-in-dataframe-columns%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
So will the values always alternate between 1 and -1? (haivng removed repetitions)
– yatu
Mar 22 at 12:00