Skip to content

Commit 85a2af7

Browse files
committed
Reformatting
1 parent d045aed commit 85a2af7

File tree

2 files changed

+10
-11
lines changed

2 files changed

+10
-11
lines changed

pandas/core/frame.py

+8-6
Original file line numberDiff line numberDiff line change
@@ -6564,7 +6564,7 @@ def apply(self, func, axis=0, raw=False, result_type=None, args=(), **kwds):
65646564
"""
65656565
from pandas.core.apply import frame_apply
65666566

6567-
#Old apply function, which will be used for each part of DataFrame
6567+
# Old apply function, which will be used for each part of DataFrame
65686568
def partial_apply(dataframe):
65696569
op = frame_apply(
65706570
dataframe,
@@ -6580,7 +6580,7 @@ def partial_apply(dataframe):
65806580
def get_dtype(dataframe, column):
65816581
return dataframe.dtypes.values[column]
65826582

6583-
if axis == 0 or axis == 'index':
6583+
if axis == 0 or axis == "index":
65846584
if self.shape[1] == 0:
65856585
return partial_apply(self)
65866586

@@ -6596,10 +6596,13 @@ def get_dtype(dataframe, column):
65966596
type = get_dtype(self, i)
65976597
j = i + 1
65986598

6599-
#While the dtype of column is the same as previous ones, they are handled together
6600-
while j < self.shape[1] and pandas.core.dtypes.common.is_dtype_equal(type, get_dtype(self, j)):
6599+
# While the dtype of column is the same as previous ones,
6600+
# they are handled together
6601+
while j < self.shape[1] and pandas.core.dtypes.common.is_dtype_equal(
6602+
type, get_dtype(self, j)
6603+
):
66016604
j += 1
6602-
frame = self.iloc[:, i: j]
6605+
frame = self.iloc[:, i:j]
66036606
i = j
66046607
result = partial_apply(frame)
66056608

@@ -6619,7 +6622,6 @@ def get_dtype(dataframe, column):
66196622
else:
66206623
return partial_apply(self)
66216624

6622-
66236625
def applymap(self, func):
66246626
"""
66256627
Apply a function to a Dataframe elementwise.

pandas/tests/frame/test_apply.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -693,11 +693,8 @@ def test_apply_dup_names_multi_agg(self):
693693

694694
def test_apply_get_dtype(self):
695695
# GH 28773
696-
df = DataFrame({
697-
"col_1": [1, 2, 3],
698-
"col_2": ["hi", "there", "friend"]
699-
})
700-
expected = Series(data=['int64', 'object'] ,index=['col_1', 'col_2'])
696+
df = DataFrame({"col_1": [1, 2, 3], "col_2": ["hi", "there", "friend"]})
697+
expected = Series(data=["int64", "object"], index=["col_1", "col_2"])
701698
tm.assert_series_equal(df.apply(lambda x: x.dtype), expected)
702699

703700

0 commit comments

Comments
 (0)