Python - How to import strings of numbers with 0 in front [duplicate]












-3
















This question already has an answer here:




  • Import pandas dataframe column as string not int

    2 answers




I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?










share|improve this question















marked as duplicate by TheIncorrigible1, coldspeed python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 17:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    See here: stackoverflow.com/questions/13293810/…

    – KuboMD
    Jan 18 at 17:23
















-3
















This question already has an answer here:




  • Import pandas dataframe column as string not int

    2 answers




I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?










share|improve this question















marked as duplicate by TheIncorrigible1, coldspeed python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 17:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • 1





    See here: stackoverflow.com/questions/13293810/…

    – KuboMD
    Jan 18 at 17:23














-3












-3








-3









This question already has an answer here:




  • Import pandas dataframe column as string not int

    2 answers




I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?










share|improve this question

















This question already has an answer here:




  • Import pandas dataframe column as string not int

    2 answers




I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?





This question already has an answer here:




  • Import pandas dataframe column as string not int

    2 answers








python string pandas dataframe integer






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 18 at 17:22









Kevin

57.8k1167110




57.8k1167110










asked Jan 18 at 17:20









stefanodv stefanodv

505




505




marked as duplicate by TheIncorrigible1, coldspeed python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 17:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.









marked as duplicate by TheIncorrigible1, coldspeed python
Users with the  python badge can single-handedly close python questions as duplicates and reopen them as needed.

StackExchange.ready(function() {
if (StackExchange.options.isMobile) return;

$('.dupe-hammer-message-hover:not(.hover-bound)').each(function() {
var $hover = $(this).addClass('hover-bound'),
$msg = $hover.siblings('.dupe-hammer-message');

$hover.hover(
function() {
$hover.showInfoMessage('', {
messageElement: $msg.clone().show(),
transient: false,
position: { my: 'bottom left', at: 'top center', offsetTop: -7 },
dismissable: false,
relativeToBody: true
});
},
function() {
StackExchange.helpers.removeMessages();
}
);
});
});
Jan 18 at 17:28


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.










  • 1





    See here: stackoverflow.com/questions/13293810/…

    – KuboMD
    Jan 18 at 17:23














  • 1





    See here: stackoverflow.com/questions/13293810/…

    – KuboMD
    Jan 18 at 17:23








1




1





See here: stackoverflow.com/questions/13293810/…

– KuboMD
Jan 18 at 17:23





See here: stackoverflow.com/questions/13293810/…

– KuboMD
Jan 18 at 17:23












1 Answer
1






active

oldest

votes


















0














By using the 'converters' parameter on your dataframe statement, e.g.



df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})





share|improve this answer






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    By using the 'converters' parameter on your dataframe statement, e.g.



    df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})





    share|improve this answer




























      0














      By using the 'converters' parameter on your dataframe statement, e.g.



      df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})





      share|improve this answer


























        0












        0








        0







        By using the 'converters' parameter on your dataframe statement, e.g.



        df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})





        share|improve this answer













        By using the 'converters' parameter on your dataframe statement, e.g.



        df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 18 at 17:25









        visualnotsobasicvisualnotsobasic

        387




        387















            Popular posts from this blog

            Callistus III

            Ostreoida

            Plistias Cous