1234567891011121314151617181920212223242526 |
- #! /usr/bin/env python
- # -*- coding: utf-8 -*-
- # vim:fenc=utf-8
- #
- # Copyright © 2024 StrayWarrior <i@straywarrior.com>
- """
- Common functions for growth jobs
- """
- UNSAFE_VIDEO_IDS = [14403867, 13696461, 13671819, 13587868, 13680796, 14050873,
- 26348326, 28623786]
- def check_unsafe_video(df, force_replace=True):
- unsafe_video_condition = ','.join([str(x) for x in UNSAFE_VIDEO_IDS])
- unsafe_rows = df.query(f'video_id in ({unsafe_video_condition})')
- if len(unsafe_rows) > 0:
- print(unsafe_rows)
- if not force_replace:
- raise Exception("video unsafe")
- df.loc[unsafe_rows.index, 'video_id'] = 20463342
- def filter_unsafe_video(df):
- unsafe_video_condition = ','.join([str(x) for x in UNSAFE_VIDEO_IDS])
- df = df.query(f'video_id not in ({unsafe_video_condition})')
- return df
|