Last active
March 10, 2022 04:46
-
-
Save shayaf84/6aac43f345626a4b6c4369959ae4c184 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
real = pd.read_csv("/content/drive/My Drive/News/True.csv") | |
fake = pd.read_csv("/content/drive/My Drive/News/Fake.csv") | |
#Shape of real news dataset | |
print("Real news: ",real.shape) | |
#Shape of fake news dataset | |
print("Fake News: ", fake.shape) | |
# Assigning a value of 0 for all real news data and placing it in the dataframe | |
class0 = [] | |
# 21417 is the length of the real news dataframe | |
for i in range(21417): | |
class0.append(0) | |
real.insert(4, "class", class0, True) | |
#Assigning a value of 1 for all fake news data and placing it in the dataframe | |
class1 = [] | |
#23481 is the length of the fake news dataframe | |
for i in range(23481): | |
class1.append(1) | |
fake.insert(4, "class", class1, True) | |
#Concactenating fake news and real news into 1 total dataset | |
total = pd.concat([real,fake]) | |
total = total.sample(frac = 1) | |
total.head() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment