Skip to content

Instantly share code, notes, and snippets.

@podhmo
Last active September 19, 2018 15:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save podhmo/34895004d7bfe8263322bab908629e10 to your computer and use it in GitHub Desktop.
import numpy as np
import pandas as pd
m = np.arange(1, 10).reshape(3, 3)
df = pd.DataFrame(m, columns=["a", "b", "c"])
print(df)
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

[python][shosai][pandas] dataframeの表示(htmlの表示)を試す


import numpy as np
import pandas as pd
%matplotlib inline
m = np.arange(1, 10).reshape(3, 3)
df = pd.DataFrame(m, columns=["a", "b", "c"])
df

<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; }
.dataframe tbody tr th {
    vertical-align: top;
}

.dataframe thead th {
    text-align: right;
}
</style>
a b c
0 1 2 3
1 4 5 6
2 7 8 9
$ nbreversible 01dataframe.py | tee 01dataframe.ipynb
$ jupyter-nbconvert --to markdown --execute 01dataframe.ipynb
$ shosai hatena push 01dataframe.md

普通に、raw htmlもhatena blogは対応しているっぽい。なるほど。

この時に利用したファイルのgist

"""# [python][shosai][pandas] dataframeの表示(htmlの表示)を試す"""
import numpy as np
import pandas as pd
# %matplotlib inline
m = np.arange(1, 10).reshape(3, 3)
df = pd.DataFrame(m, columns=["a", "b", "c"])
df
"""
```console
$ nbreversible 01dataframe.py | tee 01dataframe.ipynb
$ jupyter-nbconvert --to markdown --execute 01dataframe.ipynb
$ shosai hatena push 01dataframe.md
```
"""
"""
普通に、raw htmlもhatena blogは対応しているっぽい。なるほど。
この時に利用したファイルの[gist](https://gist.github.com/podhmo/34895004d7bfe8263322bab908629e10)
"""
00:
python 00*.py
01:
nbreversible 01dataframe.py | tee 01dataframe.ipynb
jupyter-nbconvert --to markdown --execute 01dataframe.ipynb
shosai hatena push 01dataframe.md
[
{
"id": "10257846132634996181",
"name": "2018/09/19/235710",
"title": "dataframeの表示(htmlの表示)を試す",
"created_at": "2018-09-20T00:03:20+09:00",
"draft": false,
"url": "https://blog.hatena.ne.jp/podhmo/pod.hatenablog.com/atom/entry/10257846132634996181",
"file": "01dataframe.md"
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment