From 3f6a4b3f5a941c69ace582a20acc782bff0ded9c Mon Sep 17 00:00:00 2001 From: DanielP77 Date: Tue, 12 Mar 2024 05:27:46 +0100 Subject: [PATCH] Update _yt_helpers.py dtype int translates to c datatype long, which is a 32-bit Integer on Windows. So, for very large channels, the total number of views exceeds the supported value range (try searching for channels with videos about "Cute cat", which will return channels with > 5bn views), leading to an OverflowError ("Python int too large to convert to C long"). Using dtype 'int64' explicitly uses a 64-bit Integer also on Windows machines and solves the issue. --- advertools/_yt_helpers.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/advertools/_yt_helpers.py b/advertools/_yt_helpers.py index a1739c39..8237cc7b 100644 --- a/advertools/_yt_helpers.py +++ b/advertools/_yt_helpers.py @@ -38,7 +38,7 @@ def _json_to_df(json_resp, params): for col in df: if 'Count' in col: try: - df[col] = df[col].astype(int) + df[col] = df[col].astype('int64') except ValueError: continue if ('published' in col) or ('updated' in col):