From a36f0d3d5f3926a97cda910e048e59ff6a63c720 Mon Sep 17 00:00:00 2001 From: vparekh94 Date: Mon, 22 May 2017 14:39:16 -0400 Subject: [PATCH 1/3] Update examples with imports --- pandas/core/frame.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 78a369761afc1..af21d67aee584 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -247,11 +247,13 @@ class DataFrame(NDFrame): Examples -------- + >>> import numpy as np + >>> import pandas as pd >>> d = {'col1': ts1, 'col2': ts2} - >>> df = DataFrame(data=d, index=index) - >>> df2 = DataFrame(np.random.randn(10, 5)) - >>> df3 = DataFrame(np.random.randn(10, 5), - ... columns=['a', 'b', 'c', 'd', 'e']) + >>> df = pd.DataFrame(data=d, index=index) + >>> df2 = pd.DataFrame(np.random.randn(10, 5)) + >>> df3 = pd.DataFrame(np.random.randn(10, 5), + ... columns=['a', 'b', 'c', 'd', 'e']) See also -------- From 10463c2d223673a88cfbeb5da4a5287faacb8bbb Mon Sep 17 00:00:00 2001 From: vparekh94 Date: Wed, 24 May 2017 13:49:03 -0400 Subject: [PATCH 2/3] Update frame.py --- pandas/core/frame.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index af21d67aee584..40ea3fad4f513 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -247,12 +247,18 @@ class DataFrame(NDFrame): Examples -------- - >>> import numpy as np - >>> import pandas as pd + From a dictionary of arrays: + >>> d = {'col1': ts1, 'col2': ts2} - >>> df = pd.DataFrame(data=d, index=index) - >>> df2 = pd.DataFrame(np.random.randn(10, 5)) - >>> df3 = pd.DataFrame(np.random.randn(10, 5), + >>> df = DataFrame(data=d) + + From a 2-D numpy array: + + >>> df2 = DataFrame(np.random.randn(10, 5)) + + Same, but setting the column names: + + >>> df3 = DataFrame(np.random.randn(10, 5), ... columns=['a', 'b', 'c', 'd', 'e']) See also From da63094b6f86b3b9d1c88d6c8c4034f6959c0561 Mon Sep 17 00:00:00 2001 From: vparekh94 Date: Wed, 24 May 2017 13:51:58 -0400 Subject: [PATCH 3/3] Update format and remove unused index variable --- pandas/core/frame.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 40ea3fad4f513..b4ceec717f4a3 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -259,7 +259,7 @@ class DataFrame(NDFrame): Same, but setting the column names: >>> df3 = DataFrame(np.random.randn(10, 5), - ... columns=['a', 'b', 'c', 'd', 'e']) + ... columns=['a', 'b', 'c', 'd', 'e']) See also --------