Python - How to import strings of numbers with 0 in front [duplicate]
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?
python string pandas dataframe integer
marked as duplicate by TheIncorrigible1, coldspeed
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.
add a comment |
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?
python string pandas dataframe integer
marked as duplicate by TheIncorrigible1, coldspeed
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
add a comment |
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?
python string pandas dataframe integer
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
python string pandas dataframe integer
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
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
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
add a comment |
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
add a comment |
1 Answer
1
active
oldest
votes
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})
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
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})
add a comment |
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})
add a comment |
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})
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})
answered Jan 18 at 17:25
visualnotsobasicvisualnotsobasic
387
387
add a comment |
add a comment |
1
See here: stackoverflow.com/questions/13293810/…
– KuboMD
Jan 18 at 17:23