Using Pandas, how do I strip part of a cell from an Excel file?Pandas: how to read certain file type in...
Can I retract my name from an already published manuscript?
Yeshiva University RIETS Semicha Yorei and Yadin
What is the purpose of easy combat scenarios that don't need resource expenditure?
What is better: yes / no radio, or simple checkbox?
ip vs ifconfig commands pros and cons
How Should I Define/Declare String Constants
Has the Isbell–Freyd criterion ever been used to check that a category is concretisable?
What is Crew Dragon approaching in this picture?
Why is my solution for the partial pressures of two different gases incorrect?
Eww, those bytes are gross
Why didn't Eru and/or the Valar intervene when Sauron corrupted Númenor?
When does coming up with an idea constitute sufficient contribution for authorship?
How to properly claim credit for peer review?
Wanted: 5.25 floppy to usb adapter
Why is c4 a better move in this position?
How do we edit a novel that's written by several people?
Am I a Rude Number?
Find the number of ways to express 1050 as sum of consecutive integers
How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?
I am on the US no-fly list. What can I do in order to be allowed on flights which go through US airspace?
Is my plan for fixing my water heater leak bad?
If a druid in Wild Shape swallows a creature whole, then turns back to her normal form, what happens?
How to avoid being sexist when trying to employ someone to function in a very sexist environment?
Inventor that creates machine that grabs man from future
Using Pandas, how do I strip part of a cell from an Excel file?
Pandas: how to read certain file type in pandasUnable to open .json file in pandasPandas Query Optimization On Multiple ColumnsHow to change a cell in Pandas dataframe with respective frequency of the cell in respective columnHow to Replace an object in Pandas array using replace with dictionary from excel file?Clustering Observations by String Sequences (Python/Pandas df)how to export the tables into a csv file pandasGet top 5 performers from team using pandasExtracting sections from document based on list of keywords - PythonMerging dataframes in Pandas is taking a surprisingly long time
$begingroup$
Thanks in advance, I have been struggling with this for a couple of hours now. I have a column named 'CaseNumber'. the data in that column is structured as 'Case ID Number - 00123456'.
I am trying to create a loop that will go through the entire sheet and strip 'Case ID Number - 00'. So the final output would just be the 6 digit number set.
So far I have found the attribute .strip('Case ID Number - 00') but I cannot find the logic to create the for loop.
I appreciate any insight.
python pandas
$endgroup$
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
$begingroup$
Thanks in advance, I have been struggling with this for a couple of hours now. I have a column named 'CaseNumber'. the data in that column is structured as 'Case ID Number - 00123456'.
I am trying to create a loop that will go through the entire sheet and strip 'Case ID Number - 00'. So the final output would just be the 6 digit number set.
So far I have found the attribute .strip('Case ID Number - 00') but I cannot find the logic to create the for loop.
I appreciate any insight.
python pandas
$endgroup$
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
$begingroup$
Thanks in advance, I have been struggling with this for a couple of hours now. I have a column named 'CaseNumber'. the data in that column is structured as 'Case ID Number - 00123456'.
I am trying to create a loop that will go through the entire sheet and strip 'Case ID Number - 00'. So the final output would just be the 6 digit number set.
So far I have found the attribute .strip('Case ID Number - 00') but I cannot find the logic to create the for loop.
I appreciate any insight.
python pandas
$endgroup$
Thanks in advance, I have been struggling with this for a couple of hours now. I have a column named 'CaseNumber'. the data in that column is structured as 'Case ID Number - 00123456'.
I am trying to create a loop that will go through the entire sheet and strip 'Case ID Number - 00'. So the final output would just be the 6 digit number set.
So far I have found the attribute .strip('Case ID Number - 00') but I cannot find the logic to create the for loop.
I appreciate any insight.
python pandas
python pandas
asked Feb 1 at 20:29
AdamAdam
61
61
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 9 mins ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
$begingroup$
String operations on particular columns (or series) can be done by appending .str
to the series. You can use the following command to get your output:
>>> df['Case Number'].str.strip('Case ID Number - 00')
You can refer to the documentation here Working with text.
$endgroup$
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
return StackExchange.using("mathjaxEditing", function () {
StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
});
});
}, "mathjax-editing");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "557"
};
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: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
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%2fdatascience.stackexchange.com%2fquestions%2f44940%2fusing-pandas-how-do-i-strip-part-of-a-cell-from-an-excel-file%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
$begingroup$
String operations on particular columns (or series) can be done by appending .str
to the series. You can use the following command to get your output:
>>> df['Case Number'].str.strip('Case ID Number - 00')
You can refer to the documentation here Working with text.
$endgroup$
add a comment |
$begingroup$
String operations on particular columns (or series) can be done by appending .str
to the series. You can use the following command to get your output:
>>> df['Case Number'].str.strip('Case ID Number - 00')
You can refer to the documentation here Working with text.
$endgroup$
add a comment |
$begingroup$
String operations on particular columns (or series) can be done by appending .str
to the series. You can use the following command to get your output:
>>> df['Case Number'].str.strip('Case ID Number - 00')
You can refer to the documentation here Working with text.
$endgroup$
String operations on particular columns (or series) can be done by appending .str
to the series. You can use the following command to get your output:
>>> df['Case Number'].str.strip('Case ID Number - 00')
You can refer to the documentation here Working with text.
answered Feb 2 at 6:13
bkshibkshi
57410
57410
add a comment |
add a comment |
Thanks for contributing an answer to Data Science Stack Exchange!
- 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.
Use MathJax to format equations. MathJax reference.
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%2fdatascience.stackexchange.com%2fquestions%2f44940%2fusing-pandas-how-do-i-strip-part-of-a-cell-from-an-excel-file%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