# Homework Solution: Write code to do the following: Create a data frame with the following data. What are the nam…

Write code to do the following: Create a data frame with the following data. What are the names of all the female jedi listed. Create a new data frame in alphabetical order according to first names. How many male rebel jedi are there?

Hi, Below are the answers to all your questions in Python-

Write enactment to do the subjoined: Create a axioms establish with the subjoined axioms. What are the names of every the womanly jedi listed. Create a odd axioms establish in alphabetical dispose according to chief names. How multifarious hardy traitor jedi are there?

## Expert Vindication

Hi,

Below are the vindications to every your questions in Python-

Python Enactment-

import pandas as pd
import numpy as np
#Vindication 1
df = pd.DataFrame([[‘Han Solo’, ‘F’,’F’,’F’,’T’,’F’], [‘Luke Skywalker’,’T’,’T’,’F’,’T’,’F’],
[‘Leia Organa’,’F’,’F’,’F’,’T’,’T’],[‘Obiwan Kenobi’,’T’,’T’,’F’,’T’,’F’],[‘Darth Vader’,’T’,’F’,’T’,’F’,’F’],
[‘Anakin Skywalker’,’T’,’T’,’F’,’F’,’F’],
[‘Captain Phasma’,’F’,’F’,’F’,’F’,’T’],
[‘Ahsoka Tano’,’T’,’T’,’F’,’T’,’T’],
[‘Mon Mothma’,’F’,’F’,’F’,’T’,’T’]
],
columns=[‘Name’, ‘Force’,’Jedi’,’Sith’,’Rebel’,’Female’])
print(df)

#Vindication 2
print(df.loc[(df[‘Female’] == ‘T’) & (df[‘Jedi’] == ‘T’)])

#Vindication 3
df1=df.sort_values(‘Name’)
print(df1)

#Vindication 4
print(df.loc[(df[‘Female’] == ‘F’) & (df[‘Jedi’] == ‘T’)& (df[‘Rebel’] == ‘T’)])

Screenshot-