Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

return a table of selected features pandas

# Below are quick example

# By using df[] Notation to select multiple columns
df2 = df[["Courses","Fee","Duration"]] 

# Using loc[] to take column slices
df2 = df.loc[:, ["Courses","Fee","Duration"]] # Selecte multiple columns
df2 = df.loc[:, ["Courses","Fee","Discount"]] # Select Random columns
df2 = df.loc[:,'Fee':'Discount'] # Select columns between two columns
df2 = df.loc[:,'Duration':]  # Select columns by range
df2 = df.loc[:,:'Duration']  # Select columns by range
df2 = df.loc[:,::2]          # Select every alternate column

# Using iloc[] to select column by Index
df2 = df.iloc[:,[1,3,4]] # Select columns by Index
df2 = df.iloc[:,1:4] # Select between indexes 1 and 4 (2,3,4)
df2 = df.iloc[:,2:] # Select From 3rd to end
df2 = df.iloc[:,:2] # Select First Two Columns

#Using get()
df2 = df.get(['Courses','Fee'])
Comment

PREVIOUS NEXT
Code Example
Python :: sorting list of strings by length python 
Python :: how to select the three highest entries within a category in pandas 
Python :: th most effective search methods in python with example 
Python :: get mismatch element in allclose numpy 
Python :: Plotting a dendrogram 
Python :: django query filter less than 
Python :: pandas read s3 object in jupyter notebook 
Python :: what is topic modelling in nlp 
Python :: HIDING AND ENCRYPTING PASSWORDS IN PYTHON USING MASKPASS MODULE 
Python :: append to multidimensional list python 
Python :: calculate sin cos tan python 
Python :: get a list of colors that appear of the image python 
Python :: change dimension position of numpy array 
Python :: looping through models and plotting their performance 
Python :: lunarcalendar python 
Python :: iterate over batch of dict keys at once python 
Python :: How to Merge QuerySets in Django Rest Framework 
Python :: python detect ranges in list 
Python :: cv2 pink color range 
Python :: i type nano in python and o get error 
Python :: add values to add value in a matplotlib image 
Python :: django test postgres extensions intarray 
Python :: python vergleichsoperatoren 
Python :: how to dynamically search for a class variable in python 
Python :: tkinter add new element into grid by click 
Python :: how to get entitys of word using pytho nlp 
Python :: Reduces the elements of this RDD using the specified commutative and associative binary operator 
Python :: Randomly splits this DataFrame with the provided weights 
Python :: how to create a custom function in python 
Python :: discord.py get channel name from id 
ADD CONTENT
Topic
Content
Source link
Name
3+1 =