Articles → Pandas → Return Multiple Columns From Dataframe In Pandas

Return Multiple Columns From Dataframe In Pandas






Example




import numpy as np
import pandas as pd


df = pd.DataFrame(np.random.randn(5,4),['A', 'B', 'C', 'D', 'E'],['W', 'X', 'Y', 'Z'])

print(df[['W', 'X']])




Picture showing the output of returning multiple columns from DataFrame in pandas
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Friday, April 12, 2019

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250