This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
#Create Data Frame with few columns and list values | |
df = pd.DataFrame({'A':[1,2,3,4],'B':[5,6,7,8]}) | |
print(df) | |
#Drop a Column | |
df = df.drop('A',1) | |
print(df) | |
#Create column with int column names | |
df = pd.DataFrame({1:[1,2,3,4],2:[1,2,3,4],10:[1,2,3,4]}) | |
print(df) | |
df = df.drop(1,1) | |
print(df) | |
#Sample two rows from data frame | |
print(df.sample(n=2)) | |
#Create list with 56 values | |
a = [] | |
for i in range(1,56): | |
a.append(i) | |
import random | |
#Sample 15 random entries | |
feature2 = random.sample(a,15) | |
print('feature') | |
print(df) | |
#Find maximum occuring values row wise | |
print(df.mode(axis=1)) | |
No comments:
Post a Comment