Convert values in column from hex to binary in pandas data frame










2














I have one column in pandas data frame with hex values, for example:



Data
1A
2B
BB
FF
A7
78
CB


I want to convert hex values in binary, then from binary to take first 3 bits and finally convert 3 bits value in decimal.



Data column in binary will be:



Data
00011010
00101011
10111011
11111111
10100111
01111000
11001011


the first 3 bits:



Data
010
011
011
111
111
000
011


and finally the desired value in decimal:



Data
2
3
3
7
7
0
3


How to do this? I tried with bin() function, but it doesn't work with pandas data frames.










share|improve this question

















  • 1




    Can you share your work so that it ll be easy for us to replicate.
    – Naveen
    Nov 11 '18 at 21:12










  • I shared everything I could...I wish I could share more, but it is not allowed.
    – slobokv83
    Nov 12 '18 at 8:11















2














I have one column in pandas data frame with hex values, for example:



Data
1A
2B
BB
FF
A7
78
CB


I want to convert hex values in binary, then from binary to take first 3 bits and finally convert 3 bits value in decimal.



Data column in binary will be:



Data
00011010
00101011
10111011
11111111
10100111
01111000
11001011


the first 3 bits:



Data
010
011
011
111
111
000
011


and finally the desired value in decimal:



Data
2
3
3
7
7
0
3


How to do this? I tried with bin() function, but it doesn't work with pandas data frames.










share|improve this question

















  • 1




    Can you share your work so that it ll be easy for us to replicate.
    – Naveen
    Nov 11 '18 at 21:12










  • I shared everything I could...I wish I could share more, but it is not allowed.
    – slobokv83
    Nov 12 '18 at 8:11













2












2








2







I have one column in pandas data frame with hex values, for example:



Data
1A
2B
BB
FF
A7
78
CB


I want to convert hex values in binary, then from binary to take first 3 bits and finally convert 3 bits value in decimal.



Data column in binary will be:



Data
00011010
00101011
10111011
11111111
10100111
01111000
11001011


the first 3 bits:



Data
010
011
011
111
111
000
011


and finally the desired value in decimal:



Data
2
3
3
7
7
0
3


How to do this? I tried with bin() function, but it doesn't work with pandas data frames.










share|improve this question













I have one column in pandas data frame with hex values, for example:



Data
1A
2B
BB
FF
A7
78
CB


I want to convert hex values in binary, then from binary to take first 3 bits and finally convert 3 bits value in decimal.



Data column in binary will be:



Data
00011010
00101011
10111011
11111111
10100111
01111000
11001011


the first 3 bits:



Data
010
011
011
111
111
000
011


and finally the desired value in decimal:



Data
2
3
3
7
7
0
3


How to do this? I tried with bin() function, but it doesn't work with pandas data frames.







python pandas dataframe binary hex






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 11 '18 at 21:06









slobokv83

729




729







  • 1




    Can you share your work so that it ll be easy for us to replicate.
    – Naveen
    Nov 11 '18 at 21:12










  • I shared everything I could...I wish I could share more, but it is not allowed.
    – slobokv83
    Nov 12 '18 at 8:11












  • 1




    Can you share your work so that it ll be easy for us to replicate.
    – Naveen
    Nov 11 '18 at 21:12










  • I shared everything I could...I wish I could share more, but it is not allowed.
    – slobokv83
    Nov 12 '18 at 8:11







1




1




Can you share your work so that it ll be easy for us to replicate.
– Naveen
Nov 11 '18 at 21:12




Can you share your work so that it ll be easy for us to replicate.
– Naveen
Nov 11 '18 at 21:12












I shared everything I could...I wish I could share more, but it is not allowed.
– slobokv83
Nov 12 '18 at 8:11




I shared everything I could...I wish I could share more, but it is not allowed.
– slobokv83
Nov 12 '18 at 8:11












2 Answers
2






active

oldest

votes


















3














We can do this by a chain of actions:



  1. first we convert the hexadecimal number to an int with .apply(int, base=16);

  2. next we convert this to binary data, with .apply(bin);

  3. next we chunk off the first two characters with .str[2:];

  4. then we obtain the last three characters with .str[-3:]; and

  5. finally we again interpret these as ints, with .apply(int, base=2).

So:



>>> df.Data.apply(int, base=16).apply(bin).str[2:].str[-3:].apply(int, base=2)
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


We can however use another strategy here:



  1. we first convert the hexadecimal number to an int; and

  2. then we apply a bitwise and with 0b111.

for example:



>>> df.Data.apply(int, base=16) & 0b111
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


The second attempt is not only simpler, but faster as well, approximately by 66%:



>>> timeit(first_strategy, number=10000)
6.962630775000434
>>> timeit(second_strategy, number=10000)
2.330652763019316


for a dataframe that repeats the sample data 100 times, we get:



>>> timeit(first_strategy, number=10000)
17.603060900000855
>>> timeit(second_strategy, number=10000)
5.901462858979357


this is again 66% faster.






share|improve this answer


















  • 1




    I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
    – Jon Clements
    Nov 11 '18 at 21:18











  • @JonClements: thanks for the suggestion, edited.
    – Willem Van Onsem
    Nov 11 '18 at 21:26










  • Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
    – slobokv83
    Nov 12 '18 at 7:50










  • @slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
    – Willem Van Onsem
    Nov 12 '18 at 11:10






  • 1




    @slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
    – Willem Van Onsem
    Nov 12 '18 at 12:05


















2














You can use:



df.Data.apply(lambda v: int(format(int(v, 16), '08b')[-3:], 2))


Which gives you:



0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


Those steps are:



  • Take your original data and convert it to decimal using int(number, 16) (base 16 is hex) (int('1A', 16) == 26)

  • Take that number and format it as a binary string format(number, '08b') gives you an character string of 0/1's zero filled on the left (format(26, '08b') == '00011010')

  • Take the last 3 characters of that string [-3:] ('010') and convert it to decimal with a base 2, int(binary_string[-3:], 2) gives you: 2





share|improve this answer




















  • Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
    – slobokv83
    Nov 12 '18 at 7:58










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
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253243%2fconvert-values-in-column-from-hex-to-binary-in-pandas-data-frame%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









3














We can do this by a chain of actions:



  1. first we convert the hexadecimal number to an int with .apply(int, base=16);

  2. next we convert this to binary data, with .apply(bin);

  3. next we chunk off the first two characters with .str[2:];

  4. then we obtain the last three characters with .str[-3:]; and

  5. finally we again interpret these as ints, with .apply(int, base=2).

So:



>>> df.Data.apply(int, base=16).apply(bin).str[2:].str[-3:].apply(int, base=2)
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


We can however use another strategy here:



  1. we first convert the hexadecimal number to an int; and

  2. then we apply a bitwise and with 0b111.

for example:



>>> df.Data.apply(int, base=16) & 0b111
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


The second attempt is not only simpler, but faster as well, approximately by 66%:



>>> timeit(first_strategy, number=10000)
6.962630775000434
>>> timeit(second_strategy, number=10000)
2.330652763019316


for a dataframe that repeats the sample data 100 times, we get:



>>> timeit(first_strategy, number=10000)
17.603060900000855
>>> timeit(second_strategy, number=10000)
5.901462858979357


this is again 66% faster.






share|improve this answer


















  • 1




    I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
    – Jon Clements
    Nov 11 '18 at 21:18











  • @JonClements: thanks for the suggestion, edited.
    – Willem Van Onsem
    Nov 11 '18 at 21:26










  • Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
    – slobokv83
    Nov 12 '18 at 7:50










  • @slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
    – Willem Van Onsem
    Nov 12 '18 at 11:10






  • 1




    @slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
    – Willem Van Onsem
    Nov 12 '18 at 12:05















3














We can do this by a chain of actions:



  1. first we convert the hexadecimal number to an int with .apply(int, base=16);

  2. next we convert this to binary data, with .apply(bin);

  3. next we chunk off the first two characters with .str[2:];

  4. then we obtain the last three characters with .str[-3:]; and

  5. finally we again interpret these as ints, with .apply(int, base=2).

So:



>>> df.Data.apply(int, base=16).apply(bin).str[2:].str[-3:].apply(int, base=2)
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


We can however use another strategy here:



  1. we first convert the hexadecimal number to an int; and

  2. then we apply a bitwise and with 0b111.

for example:



>>> df.Data.apply(int, base=16) & 0b111
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


The second attempt is not only simpler, but faster as well, approximately by 66%:



>>> timeit(first_strategy, number=10000)
6.962630775000434
>>> timeit(second_strategy, number=10000)
2.330652763019316


for a dataframe that repeats the sample data 100 times, we get:



>>> timeit(first_strategy, number=10000)
17.603060900000855
>>> timeit(second_strategy, number=10000)
5.901462858979357


this is again 66% faster.






share|improve this answer


















  • 1




    I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
    – Jon Clements
    Nov 11 '18 at 21:18











  • @JonClements: thanks for the suggestion, edited.
    – Willem Van Onsem
    Nov 11 '18 at 21:26










  • Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
    – slobokv83
    Nov 12 '18 at 7:50










  • @slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
    – Willem Van Onsem
    Nov 12 '18 at 11:10






  • 1




    @slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
    – Willem Van Onsem
    Nov 12 '18 at 12:05













3












3








3






We can do this by a chain of actions:



  1. first we convert the hexadecimal number to an int with .apply(int, base=16);

  2. next we convert this to binary data, with .apply(bin);

  3. next we chunk off the first two characters with .str[2:];

  4. then we obtain the last three characters with .str[-3:]; and

  5. finally we again interpret these as ints, with .apply(int, base=2).

So:



>>> df.Data.apply(int, base=16).apply(bin).str[2:].str[-3:].apply(int, base=2)
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


We can however use another strategy here:



  1. we first convert the hexadecimal number to an int; and

  2. then we apply a bitwise and with 0b111.

for example:



>>> df.Data.apply(int, base=16) & 0b111
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


The second attempt is not only simpler, but faster as well, approximately by 66%:



>>> timeit(first_strategy, number=10000)
6.962630775000434
>>> timeit(second_strategy, number=10000)
2.330652763019316


for a dataframe that repeats the sample data 100 times, we get:



>>> timeit(first_strategy, number=10000)
17.603060900000855
>>> timeit(second_strategy, number=10000)
5.901462858979357


this is again 66% faster.






share|improve this answer














We can do this by a chain of actions:



  1. first we convert the hexadecimal number to an int with .apply(int, base=16);

  2. next we convert this to binary data, with .apply(bin);

  3. next we chunk off the first two characters with .str[2:];

  4. then we obtain the last three characters with .str[-3:]; and

  5. finally we again interpret these as ints, with .apply(int, base=2).

So:



>>> df.Data.apply(int, base=16).apply(bin).str[2:].str[-3:].apply(int, base=2)
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


We can however use another strategy here:



  1. we first convert the hexadecimal number to an int; and

  2. then we apply a bitwise and with 0b111.

for example:



>>> df.Data.apply(int, base=16) & 0b111
0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


The second attempt is not only simpler, but faster as well, approximately by 66%:



>>> timeit(first_strategy, number=10000)
6.962630775000434
>>> timeit(second_strategy, number=10000)
2.330652763019316


for a dataframe that repeats the sample data 100 times, we get:



>>> timeit(first_strategy, number=10000)
17.603060900000855
>>> timeit(second_strategy, number=10000)
5.901462858979357


this is again 66% faster.







share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 11 '18 at 21:35

























answered Nov 11 '18 at 21:16









Willem Van Onsem

144k16136228




144k16136228







  • 1




    I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
    – Jon Clements
    Nov 11 '18 at 21:18











  • @JonClements: thanks for the suggestion, edited.
    – Willem Van Onsem
    Nov 11 '18 at 21:26










  • Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
    – slobokv83
    Nov 12 '18 at 7:50










  • @slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
    – Willem Van Onsem
    Nov 12 '18 at 11:10






  • 1




    @slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
    – Willem Van Onsem
    Nov 12 '18 at 12:05












  • 1




    I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
    – Jon Clements
    Nov 11 '18 at 21:18











  • @JonClements: thanks for the suggestion, edited.
    – Willem Van Onsem
    Nov 11 '18 at 21:26










  • Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
    – slobokv83
    Nov 12 '18 at 7:50










  • @slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
    – Willem Van Onsem
    Nov 12 '18 at 11:10






  • 1




    @slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
    – Willem Van Onsem
    Nov 12 '18 at 12:05







1




1




I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
– Jon Clements
Nov 11 '18 at 21:18





I like the other strategy... I might be tempted to use 0b111 instead of 7 (or possibly (1 << N) - 1 if it's going to be "the last N bits" where N is not just a couple ) or something but...
– Jon Clements
Nov 11 '18 at 21:18













@JonClements: thanks for the suggestion, edited.
– Willem Van Onsem
Nov 11 '18 at 21:26




@JonClements: thanks for the suggestion, edited.
– Willem Van Onsem
Nov 11 '18 at 21:26












Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
– slobokv83
Nov 12 '18 at 7:50




Thank you very much. It works...but if I have to extract 3 bits from the 2nd to 5th position in a byte (for example, from "10010110" it is "010"), what I have to do? For the first solution, I could put str[p1:p2] and use None if it is the end of a string. But for the second solution, which by the way I like very much, how to extract bits that I want?
– slobokv83
Nov 12 '18 at 7:50












@slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
– Willem Van Onsem
Nov 12 '18 at 11:10




@slobokv83: you can first divide it by (1<<2) (so 4), like (df.Data.apply(int, base=16) // (1 << 2)) & 0b111
– Willem Van Onsem
Nov 12 '18 at 11:10




1




1




@slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
– Willem Van Onsem
Nov 12 '18 at 12:05




@slobokv83: well as said, you can use (df.Data.apply(int, base=16) // (1 << o)) & ((1 << w) - 1) to obtain the values between the bits o and o+w, no need to slice, zfill`, etc.
– Willem Van Onsem
Nov 12 '18 at 12:05













2














You can use:



df.Data.apply(lambda v: int(format(int(v, 16), '08b')[-3:], 2))


Which gives you:



0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


Those steps are:



  • Take your original data and convert it to decimal using int(number, 16) (base 16 is hex) (int('1A', 16) == 26)

  • Take that number and format it as a binary string format(number, '08b') gives you an character string of 0/1's zero filled on the left (format(26, '08b') == '00011010')

  • Take the last 3 characters of that string [-3:] ('010') and convert it to decimal with a base 2, int(binary_string[-3:], 2) gives you: 2





share|improve this answer




















  • Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
    – slobokv83
    Nov 12 '18 at 7:58















2














You can use:



df.Data.apply(lambda v: int(format(int(v, 16), '08b')[-3:], 2))


Which gives you:



0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


Those steps are:



  • Take your original data and convert it to decimal using int(number, 16) (base 16 is hex) (int('1A', 16) == 26)

  • Take that number and format it as a binary string format(number, '08b') gives you an character string of 0/1's zero filled on the left (format(26, '08b') == '00011010')

  • Take the last 3 characters of that string [-3:] ('010') and convert it to decimal with a base 2, int(binary_string[-3:], 2) gives you: 2





share|improve this answer




















  • Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
    – slobokv83
    Nov 12 '18 at 7:58













2












2








2






You can use:



df.Data.apply(lambda v: int(format(int(v, 16), '08b')[-3:], 2))


Which gives you:



0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


Those steps are:



  • Take your original data and convert it to decimal using int(number, 16) (base 16 is hex) (int('1A', 16) == 26)

  • Take that number and format it as a binary string format(number, '08b') gives you an character string of 0/1's zero filled on the left (format(26, '08b') == '00011010')

  • Take the last 3 characters of that string [-3:] ('010') and convert it to decimal with a base 2, int(binary_string[-3:], 2) gives you: 2





share|improve this answer












You can use:



df.Data.apply(lambda v: int(format(int(v, 16), '08b')[-3:], 2))


Which gives you:



0 2
1 3
2 3
3 7
4 7
5 0
6 3
Name: Data, dtype: int64


Those steps are:



  • Take your original data and convert it to decimal using int(number, 16) (base 16 is hex) (int('1A', 16) == 26)

  • Take that number and format it as a binary string format(number, '08b') gives you an character string of 0/1's zero filled on the left (format(26, '08b') == '00011010')

  • Take the last 3 characters of that string [-3:] ('010') and convert it to decimal with a base 2, int(binary_string[-3:], 2) gives you: 2






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 11 '18 at 21:12









Jon Clements

98.3k19173218




98.3k19173218











  • Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
    – slobokv83
    Nov 12 '18 at 7:58
















  • Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
    – slobokv83
    Nov 12 '18 at 7:58















Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
– slobokv83
Nov 12 '18 at 7:58




Thank you very much. It works fine...I have another question - if I need for the length of the bits array to be variable, what I have to do? You put '08b', and if I want in some moment to be '16b', should I put like 'lengthb' and for length give some value?
– slobokv83
Nov 12 '18 at 7:58

















draft saved

draft discarded
















































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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53253243%2fconvert-values-in-column-from-hex-to-binary-in-pandas-data-frame%23new-answer', 'question_page');

);

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







Popular posts from this blog

How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

Syphilis

Darth Vader #20