diff --git a/pandas/core/series.py b/pandas/core/series.py
index e1f668dd3afda..333c7e0d2587a 100644
--- a/pandas/core/series.py
+++ b/pandas/core/series.py
@@ -6,6 +6,7 @@
# pylint: disable=E1101,E1103
# pylint: disable=W0703,W0622,W0613,W0201
+import re
import types
import warnings
from textwrap import dedent
@@ -1048,6 +1049,16 @@ def to_string(self, buf=None, na_rep='NaN', float_format=None, header=True,
with open(buf, 'w') as f:
f.write(result)
+ def _repr_html_(self):
+ """
+ Return a html representation for a particular Series.
+ Mainly for IPython notebook.
+ """
+ df = self.to_frame()
+ s = df._repr_html_()
+ s2 = re.sub(r'(.*)', '', s, flags=re.DOTALL)
+ return s2
+
def __iter__(self):
""" provide iteration over the values of the Series
box values if necessary """
diff --git a/series_html_demo.ipynb b/series_html_demo.ipynb
new file mode 100644
index 0000000000000..9bc6fbe95ad10
--- /dev/null
+++ b/series_html_demo.ipynb
@@ -0,0 +1,228 @@
+{
+ "cells": [
+ {
+ "cell_type": "code",
+ "execution_count": 1,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "import pandas as pd"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 2,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "series = pd.Series([])"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": [
+ "series[0] = 'zero'\n",
+ "series[1] = 'one'"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 4,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "
\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " zero | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " one | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ "0 zero\n",
+ "1 one\n",
+ "dtype: object"
+ ]
+ },
+ "execution_count": 4,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "series"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 5,
+ "metadata": {},
+ "outputs": [
+ {
+ "name": "stdout",
+ "output_type": "stream",
+ "text": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " zero | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " one | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
\n"
+ ]
+ }
+ ],
+ "source": [
+ "print(series._repr_html_())"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 6,
+ "metadata": {},
+ "outputs": [],
+ "source": [
+ "df = series.to_frame()"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 7,
+ "metadata": {},
+ "outputs": [
+ {
+ "data": {
+ "text/html": [
+ "\n",
+ "\n",
+ "
\n",
+ " \n",
+ " \n",
+ " | \n",
+ " 0 | \n",
+ "
\n",
+ " \n",
+ " \n",
+ " \n",
+ " 0 | \n",
+ " zero | \n",
+ "
\n",
+ " \n",
+ " 1 | \n",
+ " one | \n",
+ "
\n",
+ " \n",
+ "
\n",
+ "
"
+ ],
+ "text/plain": [
+ " 0\n",
+ "0 zero\n",
+ "1 one"
+ ]
+ },
+ "execution_count": 7,
+ "metadata": {},
+ "output_type": "execute_result"
+ }
+ ],
+ "source": [
+ "df"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": null,
+ "metadata": {
+ "collapsed": true
+ },
+ "outputs": [],
+ "source": []
+ }
+ ],
+ "metadata": {
+ "kernelspec": {
+ "display_name": "Python 3",
+ "language": "python",
+ "name": "python3"
+ },
+ "language_info": {
+ "codemirror_mode": {
+ "name": "ipython",
+ "version": 3
+ },
+ "file_extension": ".py",
+ "mimetype": "text/x-python",
+ "name": "python",
+ "nbconvert_exporter": "python",
+ "pygments_lexer": "ipython3",
+ "version": "3.6.1"
+ }
+ },
+ "nbformat": 4,
+ "nbformat_minor": 2
+}