Spaces:
Runtime error
Runtime error
Merge pull request #65 from Demea9000/57-fixa-pandas-warning
Browse files
textclassifier/TextClassifier.py
CHANGED
@@ -8,6 +8,10 @@ from datetime import date
|
|
8 |
import os
|
9 |
from dotenv import find_dotenv, load_dotenv
|
10 |
import pandas as pd
|
|
|
|
|
|
|
|
|
11 |
|
12 |
# Set one directory up into ROOT_PATH
|
13 |
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
@@ -50,7 +54,7 @@ class TextClassifier:
|
|
50 |
raise Exception("Could not get enough tweets. Please try again. Perhaps try different time range.")
|
51 |
continue
|
52 |
# Make id as type int64
|
53 |
-
self.df['id'] = self.df
|
54 |
# self.api_key = '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'
|
55 |
openai.api_key = OPENAI_AUTHTOKEN
|
56 |
|
|
|
8 |
import os
|
9 |
from dotenv import find_dotenv, load_dotenv
|
10 |
import pandas as pd
|
11 |
+
import warnings
|
12 |
+
from pandas.core.common import SettingWithCopyWarning
|
13 |
+
|
14 |
+
warnings.simplefilter(action="ignore", category=SettingWithCopyWarning)
|
15 |
|
16 |
# Set one directory up into ROOT_PATH
|
17 |
ROOT_PATH = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
|
|
54 |
raise Exception("Could not get enough tweets. Please try again. Perhaps try different time range.")
|
55 |
continue
|
56 |
# Make id as type int64
|
57 |
+
self.df.loc[:, 'id'] = self.df.id.copy().apply(lambda x: int(x))
|
58 |
# self.api_key = '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'
|
59 |
openai.api_key = OPENAI_AUTHTOKEN
|
60 |
|