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'])
python pandas jupyter-notebook
|
show 2 more comments
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'])
python pandas jupyter-notebook
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 didpd.set_options('max_colwidth', -1)
to get whole text displayed.
– bakka
Nov 8 at 12:17
|
show 2 more comments
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'])
python pandas jupyter-notebook
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
python pandas jupyter-notebook
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 didpd.set_options('max_colwidth', -1)
to get whole text displayed.
– bakka
Nov 8 at 12:17
|
show 2 more comments
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 didpd.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
|
show 2 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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.
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%2f53206851%2fhow-to-display-pandas-series-in-pretty-way%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
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