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'])

df[['W', 'X']]




Click to Enlarge


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

Query/Feedback


Your Email Id  
 
Subject 
 
Query/FeedbackCharacters remaining 250