Datasets:
Upload reddit_climate_comment.py
Browse files
reddit_climate_comment.py
CHANGED
@@ -24,7 +24,7 @@ class NewDataset(GeneratorBasedBuilder):
|
|
24 |
"post_author": Value("string"),
|
25 |
"post_body": Value("string"),
|
26 |
"post_url": Value("string"),
|
27 |
-
"post_pic": Value("
|
28 |
"subreddit": Value("string"),
|
29 |
"post_timestamp": Value("string"),
|
30 |
"post_upvotes": Value("int32"),
|
@@ -55,7 +55,8 @@ class NewDataset(GeneratorBasedBuilder):
|
|
55 |
|
56 |
def _generate_examples(self, filepath):
|
57 |
df = pd.read_csv(filepath)
|
58 |
-
|
|
|
59 |
# Group the DataFrame by post ID
|
60 |
grouped_df = df.groupby('PostID')
|
61 |
|
|
|
24 |
"post_author": Value("string"),
|
25 |
"post_body": Value("string"),
|
26 |
"post_url": Value("string"),
|
27 |
+
"post_pic": Value("image"),
|
28 |
"subreddit": Value("string"),
|
29 |
"post_timestamp": Value("string"),
|
30 |
"post_upvotes": Value("int32"),
|
|
|
55 |
|
56 |
def _generate_examples(self, filepath):
|
57 |
df = pd.read_csv(filepath)
|
58 |
+
for column in df.columns:
|
59 |
+
df[column] = df[column].replace({pd.NA: None})
|
60 |
# Group the DataFrame by post ID
|
61 |
grouped_df = df.groupby('PostID')
|
62 |
|