How do I remove name and dtype from pandas output The Next CEO of Stack OverflowHow to flush output of print function?How can I remove a trailing newline in Python?How to randomly select an item from a list?How do I remove an element from a list by index in Python?How to remove items from a list while iterating?How to remove a key from a Python dictionary?Delete column from pandas DataFrame by column nameHow 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 headers
Lucky Feat: How can "more than one creature spend a luck point to influence the outcome of a roll"?
Redefining symbol midway through a document
What is the difference between "hamstring tendon" and "common hamstring tendon"?
Expectation in a stochastic differential equation
When "be it" is at the beginning of a sentence, what kind of structure do you call it?
Players Circumventing the limitations of Wish
Can Sneak Attack be used when hitting with an improvised weapon?
Can someone explain this formula for calculating Manhattan distance?
Computationally populating tables with probability data
Can you teleport closer to a creature you are Frightened of?
Is it convenient to ask the journal's editor for two additional days to complete a review?
How to avoid supervisors with prejudiced views?
Are the names of these months realistic?
(How) Could a medieval fantasy world survive a magic-induced "nuclear winter"?
What difference does it make using sed with/without whitespaces?
From jafe to El-Guest
Purpose of level-shifter with same in and out voltages
Yu-Gi-Oh cards in Python 3
How did Beeri the Hittite come up with naming his daughter Yehudit?
Is it okay to majorly distort historical facts while writing a fiction story?
Why the last AS PATH item always is `I` or `?`?
Small nick on power cord from an electric alarm clock, and copper wiring exposed but intact
What would be the main consequences for a country leaving the WTO?
Defamation due to breach of confidentiality
How do I remove name and dtype from pandas output
The Next CEO of Stack OverflowHow to flush output of print function?How can I remove a trailing newline in Python?How to randomly select an item from a list?How do I remove an element from a list by index in Python?How to remove items from a list while iterating?How to remove a key from a Python dictionary?Delete column from pandas DataFrame by column nameHow 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 headers
I have output that looks like this:
nutrition_info_256174499 = df1.loc[:"Salt" , "%Reference Intake*"]
print (nutrition_info_256174499)
Typical Values
Energy 5%
Fat 1%
of which saturates 1%
Carbohydrates 7%
of which sugars 2%
Fibre -
Protein 7%
Salt 6%
Name: %Reference Intake*, dtype: object
What must be done to remove both Name and dtype at end of output?
python pandas
add a comment |
I have output that looks like this:
nutrition_info_256174499 = df1.loc[:"Salt" , "%Reference Intake*"]
print (nutrition_info_256174499)
Typical Values
Energy 5%
Fat 1%
of which saturates 1%
Carbohydrates 7%
of which sugars 2%
Fibre -
Protein 7%
Salt 6%
Name: %Reference Intake*, dtype: object
What must be done to remove both Name and dtype at end of output?
python pandas
add a comment |
I have output that looks like this:
nutrition_info_256174499 = df1.loc[:"Salt" , "%Reference Intake*"]
print (nutrition_info_256174499)
Typical Values
Energy 5%
Fat 1%
of which saturates 1%
Carbohydrates 7%
of which sugars 2%
Fibre -
Protein 7%
Salt 6%
Name: %Reference Intake*, dtype: object
What must be done to remove both Name and dtype at end of output?
python pandas
I have output that looks like this:
nutrition_info_256174499 = df1.loc[:"Salt" , "%Reference Intake*"]
print (nutrition_info_256174499)
Typical Values
Energy 5%
Fat 1%
of which saturates 1%
Carbohydrates 7%
of which sugars 2%
Fibre -
Protein 7%
Salt 6%
Name: %Reference Intake*, dtype: object
What must be done to remove both Name and dtype at end of output?
python pandas
python pandas
edited Mar 7 at 17:57
Darkonaut
4,79921429
4,79921429
asked Oct 27 '18 at 18:48
NabihNabih
82
82
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Use the .values
attribute.
Example:
s = pd.Series(['race','gender'],index=[1,2])
print(s)
Out[159]:
1 race
2 gender
dtype: object
s.values
array(['race', 'gender'], dtype=object)
You can convert to a list or access each value:
list(s)
['race', 'gender']
add a comment |
For printing with preserving index you can use .to_string()
:
df = pd.DataFrame('a': [1,2,3], 'b': [2.23, 0.23, 2.3], index=['x1', 'x2', 'x3'])
print(df.loc[:'x2', 'b'].to_string())
# Out:
x1 2.23
x2 0.23
add a comment |
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%2f53025207%2fhow-do-i-remove-name-and-dtype-from-pandas-output%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Use the .values
attribute.
Example:
s = pd.Series(['race','gender'],index=[1,2])
print(s)
Out[159]:
1 race
2 gender
dtype: object
s.values
array(['race', 'gender'], dtype=object)
You can convert to a list or access each value:
list(s)
['race', 'gender']
add a comment |
Use the .values
attribute.
Example:
s = pd.Series(['race','gender'],index=[1,2])
print(s)
Out[159]:
1 race
2 gender
dtype: object
s.values
array(['race', 'gender'], dtype=object)
You can convert to a list or access each value:
list(s)
['race', 'gender']
add a comment |
Use the .values
attribute.
Example:
s = pd.Series(['race','gender'],index=[1,2])
print(s)
Out[159]:
1 race
2 gender
dtype: object
s.values
array(['race', 'gender'], dtype=object)
You can convert to a list or access each value:
list(s)
['race', 'gender']
Use the .values
attribute.
Example:
s = pd.Series(['race','gender'],index=[1,2])
print(s)
Out[159]:
1 race
2 gender
dtype: object
s.values
array(['race', 'gender'], dtype=object)
You can convert to a list or access each value:
list(s)
['race', 'gender']
answered Oct 27 '18 at 18:53
makarosmakaros
6,57122547
6,57122547
add a comment |
add a comment |
For printing with preserving index you can use .to_string()
:
df = pd.DataFrame('a': [1,2,3], 'b': [2.23, 0.23, 2.3], index=['x1', 'x2', 'x3'])
print(df.loc[:'x2', 'b'].to_string())
# Out:
x1 2.23
x2 0.23
add a comment |
For printing with preserving index you can use .to_string()
:
df = pd.DataFrame('a': [1,2,3], 'b': [2.23, 0.23, 2.3], index=['x1', 'x2', 'x3'])
print(df.loc[:'x2', 'b'].to_string())
# Out:
x1 2.23
x2 0.23
add a comment |
For printing with preserving index you can use .to_string()
:
df = pd.DataFrame('a': [1,2,3], 'b': [2.23, 0.23, 2.3], index=['x1', 'x2', 'x3'])
print(df.loc[:'x2', 'b'].to_string())
# Out:
x1 2.23
x2 0.23
For printing with preserving index you can use .to_string()
:
df = pd.DataFrame('a': [1,2,3], 'b': [2.23, 0.23, 2.3], index=['x1', 'x2', 'x3'])
print(df.loc[:'x2', 'b'].to_string())
# Out:
x1 2.23
x2 0.23
answered Oct 27 '18 at 19:23
DarkonautDarkonaut
4,79921429
4,79921429
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%2f53025207%2fhow-do-i-remove-name-and-dtype-from-pandas-output%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