Today I learned how to extract multiple columns from a dataset and store it in a dataframe for further analysis.
In this section, I want to display the following columns of the volcano dataset that caused a Tsunami ('Year', 'Month', 'day', 'Name','Location','Country').
import pandas as pd vol = pd.read_csv("vol.txt",sep="\t",header=0)
There are 2 parts:
1) Extraction of data
tsunami_vol dataframe was created with required columns using Dataframe() function of pandas and set column = ["column names"]
2) Using subset to extact required rows of data (volcanos that caused tsunami)
This displays the top 10 volcanos that caused a tsunami.