Snippets Collections
rep=,
number,name,date
1,MARCO PINERO,06/25/2021
2,JHON DOE,06/24/2021
3,MICHEL GRUBER,06/27/2021
4,DELIA VAN THASTEN,06/28/2021
5,MILTON BRIGHT,06/29/2021
Syntax
<Result> = Encrypt(<String to encrypt> , <Password> [, <Type of encryption> [, <Format of encrypted string>]])

Res = Encrypt("My credit card number is 52327453829011", "Password")
# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)

# Print out drives_right column as Series
print(cars.loc[:, 'drives_right'])
print(cars.iloc[:, 1])

# Print out drives_right column as DataFrame
print(cars.loc[:, ['drives_right']])
print(cars.iloc[:, [1]]) #[] square brackets are very sensitive here


# Print out cars_per_cap and drives_right as DataFrame
print(cars.loc[:, ['drives_right', 'cars_per_cap']])
print(cars.iloc[:, [0,2]]) #[] square brackets are very sensitive here

# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)

# Print out drives_right value of Morocco
print(cars.loc[['MOR', 'drives_right']])

# Print sub-DataFrame
print(cars.iloc[[4,5], [1,2]])
# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)

# Print out observation for Japan
print(cars.loc['JPN'])
print(cars.iloc[2])

# Print out observations for Australia and Egypt
print(cars.loc[['AUS','EG']])
print(cars.iloc[[1,6]])
# Import cars data
import pandas as pd
cars = pd.read_csv('cars.csv', index_col = 0)

# Print out country column as Pandas Series
print(cars['country'])

# Print out country column as Pandas DataFrame
print(cars[['country']])


# Print out DataFrame with country and drives_right columns
print(cars[['country','drives_right']])
# Import pandas as pd
import pandas as pd

# Fix import by including index_col
cars = pd.read_csv('cars.csv', index_col = 0)

# Print out cars
print(cars)

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension