Advertisement
Guest User

Untitled

a guest
Apr 18th, 2021
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. import numpy as np
  2. def a(df1):
  3.     start = 0
  4.     for index, value in df1['дата'].items():
  5.         b = index + 1
  6.         df1['дата2'] = np.where(df1['№ Скважины'][index] == df1['№ Скважины'][b] and monthdelta(df1['дата'][index], df1['дата'][b]) >= 2, (value+relativedelta(months=1)), np.nan)
  7.         df1 = df1.reset_index(drop=False)
  8.         start+=1
  9.         df1 = pd.lreshape(df1, {'дата': ['дата', 'дата2']})
  10.         df1 = df1.sort_values(by='index')
  11.         df1 = df1.drop('index', axis=1)
  12.     return df1
  13.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement