Skip to content

Commit 2e64e39

Browse files
FHaasePingviinituutti
authored andcommitted
DOC: Fix PEP-8 issues in comparison_with_sas.rst (pandas-dev#23902)
Signed-off-by: Fabian Haase <[email protected]>
1 parent 2fb50b9 commit 2e64e39

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

doc/source/comparison_with_sas.rst

+12-13
Original file line numberDiff line numberDiff line change
@@ -105,9 +105,7 @@ and the values are the data.
105105

106106
.. ipython:: python
107107
108-
df = pd.DataFrame({
109-
'x': [1, 3, 5],
110-
'y': [2, 4, 6]})
108+
df = pd.DataFrame({'x': [1, 3, 5], 'y': [2, 4, 6]})
111109
df
112110
113111
@@ -131,7 +129,8 @@ The pandas method is :func:`read_csv`, which works similarly.
131129

132130
.. ipython:: python
133131
134-
url = 'https://raw.github.com/pandas-dev/pandas/master/pandas/tests/data/tips.csv'
132+
url = ('https://raw.github.com/pandas-dev/'
133+
'pandas/master/pandas/tests/data/tips.csv')
135134
tips = pd.read_csv(url)
136135
tips.head()
137136
@@ -289,17 +288,17 @@ see the :ref:`timeseries documentation<timeseries>` for more details.
289288
tips['date1_year'] = tips['date1'].dt.year
290289
tips['date2_month'] = tips['date2'].dt.month
291290
tips['date1_next'] = tips['date1'] + pd.offsets.MonthBegin()
292-
tips['months_between'] = (tips['date2'].dt.to_period('M') -
293-
tips['date1'].dt.to_period('M'))
291+
tips['months_between'] = (
292+
tips['date2'].dt.to_period('M') - tips['date1'].dt.to_period('M'))
294293
295-
tips[['date1','date2','date1_year','date2_month',
296-
'date1_next','months_between']].head()
294+
tips[['date1', 'date2', 'date1_year', 'date2_month',
295+
'date1_next', 'months_between']].head()
297296
298297
.. ipython:: python
299298
:suppress:
300299
301-
tips = tips.drop(['date1','date2','date1_year',
302-
'date2_month','date1_next','months_between'], axis=1)
300+
tips = tips.drop(['date1', 'date2', 'date1_year',
301+
'date2_month', 'date1_next', 'months_between'], axis=1)
303302
304303
Selection of Columns
305304
~~~~~~~~~~~~~~~~~~~~
@@ -335,7 +334,7 @@ The same operations are expressed in pandas below.
335334
tips.drop('sex', axis=1).head()
336335
337336
# rename
338-
tips.rename(columns={'total_bill':'total_bill_2'}).head()
337+
tips.rename(columns={'total_bill': 'total_bill_2'}).head()
339338
340339
341340
Sorting by Values
@@ -508,7 +507,7 @@ The following tables will be used in the merge examples
508507
'value': np.random.randn(4)})
509508
df1
510509
df2 = pd.DataFrame({'key': ['B', 'D', 'D', 'E'],
511-
'value': np.random.randn(4)})
510+
'value': np.random.randn(4)})
512511
df2
513512
514513
In SAS, data must be explicitly sorted before merging. Different
@@ -695,7 +694,7 @@ In pandas this would be written as:
695694

696695
.. ipython:: python
697696
698-
tips.groupby(['sex','smoker']).first()
697+
tips.groupby(['sex', 'smoker']).first()
699698
700699
701700
Other Considerations

0 commit comments

Comments
 (0)