回答編集履歴

2

Update

2022/06/16 13:30

投稿

melian
melian

スコア19816

test CHANGED
@@ -8,7 +8,7 @@
8
8
  def _constructor(self):
9
9
  return TestCol
10
10
 
11
- def rowmove(self, col_src, col_dst, n):
11
+ def rowmove(self, col_src, col_dst, n=1):
12
12
  self[col_dst] = self[col_src].shift(n)
13
13
 
14
14
  if __name__ == '__main__':
@@ -16,7 +16,7 @@
16
16
  'col2' : [4,12,2,14,15,16]}
17
17
 
18
18
  test_instance = TestCol(data)
19
- test_instance.rowmove('col2', 'test', 1)
19
+ test_instance.rowmove('col2', 'test')
20
20
  print(test_instance)
21
21
 
22
22
  #

1

Update

2022/06/16 13:11

投稿

melian
melian

スコア19816

test CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  ```python
4
4
  import pandas as pd
5
- import numpy as np
6
5
 
7
6
  class TestCol(pd.DataFrame):
8
7
  @property