How to display pandas Series in pretty way?











up vote
-2
down vote

favorite












I am working with pandas in jupyter notebook. It's easy to adjust the display of DataFrame, like using pandas.set_options or import IPython.display or any suggestion from here



However it seems those methods don't apply to a Series or maybe I didn't find the right key. Particularly for my case where the Series comes from DataFrame.loc, and it has a long sentence as the value. I did pd.set_options('max_colwidth', -1) to get the whole text displayed. However it prints like below:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


How to make it printed like:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


Here is sample of my Series (though actually I'm getting Series by selecting a row in Dataframe):



import pandas as pd
pd.set_options('max_colwidth', -1)
s = pd.Series(['Which of the following cloud computing products have you used at work or school in the last 5 years (Select all that apply)? - Selected Choice', 'What metrics do you or your organization use to determine whether or not your models were successful? (Select all that apply) - Selected Choice'])









share|improve this question




















  • 3




    What is the actual series? What did you do to get that output? What is the desired output?
    – Goyo
    Nov 8 at 11:38






  • 2




    Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
    – jpp
    Nov 8 at 11:46










  • Sorry, I forgot to do that. Hope its clearer now
    – bakka
    Nov 8 at 11:52










  • @bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
    – jpp
    Nov 8 at 11:57






  • 1




    @jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
    – bakka
    Nov 8 at 12:17

















up vote
-2
down vote

favorite












I am working with pandas in jupyter notebook. It's easy to adjust the display of DataFrame, like using pandas.set_options or import IPython.display or any suggestion from here



However it seems those methods don't apply to a Series or maybe I didn't find the right key. Particularly for my case where the Series comes from DataFrame.loc, and it has a long sentence as the value. I did pd.set_options('max_colwidth', -1) to get the whole text displayed. However it prints like below:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


How to make it printed like:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


Here is sample of my Series (though actually I'm getting Series by selecting a row in Dataframe):



import pandas as pd
pd.set_options('max_colwidth', -1)
s = pd.Series(['Which of the following cloud computing products have you used at work or school in the last 5 years (Select all that apply)? - Selected Choice', 'What metrics do you or your organization use to determine whether or not your models were successful? (Select all that apply) - Selected Choice'])









share|improve this question




















  • 3




    What is the actual series? What did you do to get that output? What is the desired output?
    – Goyo
    Nov 8 at 11:38






  • 2




    Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
    – jpp
    Nov 8 at 11:46










  • Sorry, I forgot to do that. Hope its clearer now
    – bakka
    Nov 8 at 11:52










  • @bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
    – jpp
    Nov 8 at 11:57






  • 1




    @jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
    – bakka
    Nov 8 at 12:17















up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











I am working with pandas in jupyter notebook. It's easy to adjust the display of DataFrame, like using pandas.set_options or import IPython.display or any suggestion from here



However it seems those methods don't apply to a Series or maybe I didn't find the right key. Particularly for my case where the Series comes from DataFrame.loc, and it has a long sentence as the value. I did pd.set_options('max_colwidth', -1) to get the whole text displayed. However it prints like below:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


How to make it printed like:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


Here is sample of my Series (though actually I'm getting Series by selecting a row in Dataframe):



import pandas as pd
pd.set_options('max_colwidth', -1)
s = pd.Series(['Which of the following cloud computing products have you used at work or school in the last 5 years (Select all that apply)? - Selected Choice', 'What metrics do you or your organization use to determine whether or not your models were successful? (Select all that apply) - Selected Choice'])









share|improve this question















I am working with pandas in jupyter notebook. It's easy to adjust the display of DataFrame, like using pandas.set_options or import IPython.display or any suggestion from here



However it seems those methods don't apply to a Series or maybe I didn't find the right key. Particularly for my case where the Series comes from DataFrame.loc, and it has a long sentence as the value. I did pd.set_options('max_colwidth', -1) to get the whole text displayed. However it prints like below:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


How to make it printed like:



0   this sentence is long s.t. it 
is displayed like this.
1 this sentence is long s.t. it
is displayed like this.


Here is sample of my Series (though actually I'm getting Series by selecting a row in Dataframe):



import pandas as pd
pd.set_options('max_colwidth', -1)
s = pd.Series(['Which of the following cloud computing products have you used at work or school in the last 5 years (Select all that apply)? - Selected Choice', 'What metrics do you or your organization use to determine whether or not your models were successful? (Select all that apply) - Selected Choice'])






python pandas jupyter-notebook






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 8 at 12:19

























asked Nov 8 at 11:29









bakka

723317




723317








  • 3




    What is the actual series? What did you do to get that output? What is the desired output?
    – Goyo
    Nov 8 at 11:38






  • 2




    Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
    – jpp
    Nov 8 at 11:46










  • Sorry, I forgot to do that. Hope its clearer now
    – bakka
    Nov 8 at 11:52










  • @bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
    – jpp
    Nov 8 at 11:57






  • 1




    @jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
    – bakka
    Nov 8 at 12:17
















  • 3




    What is the actual series? What did you do to get that output? What is the desired output?
    – Goyo
    Nov 8 at 11:38






  • 2




    Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
    – jpp
    Nov 8 at 11:46










  • Sorry, I forgot to do that. Hope its clearer now
    – bakka
    Nov 8 at 11:52










  • @bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
    – jpp
    Nov 8 at 11:57






  • 1




    @jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
    – bakka
    Nov 8 at 12:17










3




3




What is the actual series? What did you do to get that output? What is the desired output?
– Goyo
Nov 8 at 11:38




What is the actual series? What did you do to get that output? What is the desired output?
– Goyo
Nov 8 at 11:38




2




2




Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
– jpp
Nov 8 at 11:46




Please define an example series explicitly, e.g. s = pd.Series(['.....', '.....']). If we can't reproduce your problem, it's unlikely we can resolve it.
– jpp
Nov 8 at 11:46












Sorry, I forgot to do that. Hope its clearer now
– bakka
Nov 8 at 11:52




Sorry, I forgot to do that. Hope its clearer now
– bakka
Nov 8 at 11:52












@bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
– jpp
Nov 8 at 11:57




@bakka, I can't replicate, I suggest you provide some version numbers (Python, Pandas, Ipython).
– jpp
Nov 8 at 11:57




1




1




@jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
– bakka
Nov 8 at 12:17






@jpp Ah ok. I did pd.set_options('max_colwidth', -1) to get whole text displayed.
– bakka
Nov 8 at 12:17



















active

oldest

votes











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',
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%2f53206851%2fhow-to-display-pandas-series-in-pretty-way%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















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%2f53206851%2fhow-to-display-pandas-series-in-pretty-way%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







這個網誌中的熱門文章

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Xamarin.form Move up view when keyboard appear

JBPM : POST request for execute process go wrong