How to convert a Series to a Dataframe and pivot it 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 to merge two dictionaries in a single expression?How do I check whether a file exists without exceptions?How to make a chain of function decorators?Renaming columns in pandasAdding new column to existing DataFrame in Python pandasHow to drop rows of Pandas DataFrame whose value in certain columns is NaNHow 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 headersConvert list of dictionaries to a pandas DataFrame
Girl Hackers - Logic Puzzle
What does it mean that physics no longer uses mechanical models to describe phenomena?
How did Fremen produce and carry enough thumpers to use Sandworms as de facto Ubers?
How much damage would a cupful of neutron star matter do to the Earth?
Why weren't discrete x86 CPUs ever used in game hardware?
What do you call the main part of a joke?
macOS: Name for app shortcut screen found by pinching with thumb and three fingers
Why does it sometimes sound good to play a grace note as a lead in to a note in a melody?
Is there hard evidence that the grant peer review system performs significantly better than random?
Putting class ranking in CV, but against dept guidelines
How can I set the aperture on my DSLR when it's attached to a telescope instead of a lens?
How can I prevent/balance waiting and turtling as a response to cooldown mechanics
Is there public access to the Meteor Crater in Arizona?
What initially awakened the Balrog?
Why do early math courses focus on the cross sections of a cone and not on other 3D objects?
How were pictures turned from film to a big picture in a picture frame before digital scanning?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
Does the Mueller report show a conspiracy between Russia and the Trump Campaign?
Why is it faster to reheat something than it is to cook it?
What does this say in Elvish?
What is the difference between a "ranged attack" and a "ranged weapon attack"?
How to report t statistic from R
Lagrange four-squares theorem --- deterministic complexity
Conditions when a permutation matrix is symmetric
How to convert a Series to a Dataframe and pivot it
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 to merge two dictionaries in a single expression?How do I check whether a file exists without exceptions?How to make a chain of function decorators?Renaming columns in pandasAdding new column to existing DataFrame in Python pandasHow to drop rows of Pandas DataFrame whose value in certain columns is NaNHow 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 headersConvert list of dictionaries to a pandas DataFrame
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I have a Series which looks like below
col1 A
col2 B
col3 C
I would like to convert it to a dataframe which looks like
col1, col2, col3
A, B, C
How can I do that?
python pandas
add a comment |
I have a Series which looks like below
col1 A
col2 B
col3 C
I would like to convert it to a dataframe which looks like
col1, col2, col3
A, B, C
How can I do that?
python pandas
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
thanks it worked
– H.Z.
Mar 8 at 22:15
add a comment |
I have a Series which looks like below
col1 A
col2 B
col3 C
I would like to convert it to a dataframe which looks like
col1, col2, col3
A, B, C
How can I do that?
python pandas
I have a Series which looks like below
col1 A
col2 B
col3 C
I would like to convert it to a dataframe which looks like
col1, col2, col3
A, B, C
How can I do that?
python pandas
python pandas
asked Mar 8 at 22:05
H.Z.H.Z.
1,86064497
1,86064497
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
thanks it worked
– H.Z.
Mar 8 at 22:15
add a comment |
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
thanks it worked
– H.Z.
Mar 8 at 22:15
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
thanks it worked
– H.Z.
Mar 8 at 22:15
thanks it worked
– H.Z.
Mar 8 at 22:15
add a comment |
1 Answer
1
active
oldest
votes
series.to_frame().T
This is for converting series to dataframe.
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%2f55071638%2fhow-to-convert-a-series-to-a-dataframe-and-pivot-it%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
series.to_frame().T
This is for converting series to dataframe.
add a comment |
series.to_frame().T
This is for converting series to dataframe.
add a comment |
series.to_frame().T
This is for converting series to dataframe.
series.to_frame().T
This is for converting series to dataframe.
edited Mar 8 at 22:18
cs95
143k25164249
143k25164249
answered Mar 8 at 22:16
Bibliophile20Bibliophile20
31012
31012
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%2f55071638%2fhow-to-convert-a-series-to-a-dataframe-and-pivot-it%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
s.to_frame().T
– Wen-Ben
Mar 8 at 22:07
thanks it worked
– H.Z.
Mar 8 at 22:15