问题
I tried copy - pasting the output of the dataframe from the jupyter notebook in the question followed by Ctrl+K
command,
However this happend,
SUMLEV REGION COUNTY STNAME CTYNAME CENSUS2010POP ESTIMATESBASE2010
0 50 3 1 Alabama Autauga County 54571 54571
1 50 3 3 Alabama Baldwin County 182265 182265
2 50 3 5 Alabama Barbour County 27457 27457
3 50 4 3 Arizona Cochise County 131346 131357
4 50 4 5 Arizona Coconino County 134421 134437
5 50 4 7 Arizona Gila County 53597 53597
6 50 4 21 California Glenn County 28122 28122
7 50 4 23 California Humboldt County 134623 134623
8 50 4 25 California Imperial County 174528 174528
Actual Dataframe:
But as you can see from the above, the table gets jumbled. Editing it line by line will consume a lot of time. Is there a fast way to do this? I know I could just upload the snipshots but still if i could just copy-paste the output quickly without taking snapshots again and again.
People have done this, see How to sort a pandas dataframe by columns and a part of multi index simultaneously without modifying the dataframe
In the above link, if you check the answer of the question that has been accepted then you can see that the dataframe is intact, just as it would be in a jupyter notebook output and the guy who wrote the answer also paste the input and output cells as it is from the notebook. I want to do the same.
来源:https://stackoverflow.com/questions/61640964/how-should-i-post-my-output-of-a-dataframe-from-my-juptyer-notebook-in-stack-ove