Menu

Loading the Dataset

Loading the Dataset

The next step is to load the HuffPost News Category Dataset into a Pandas DataFrame. This allows us to organize the data into rows and columns, making it easier to inspect, clean, and analyze.

Code

news = pd.read_json(
"News_Category_Dataset_v3.json",
lines=True
)

Explanation

The read_json() function reads the JSON dataset into a Pandas DataFrame.

The parameter lines=True indicates that each line in the JSON file represents a separate news article.

Output

The dataset is successfully loaded into the variable news.