# data[].attributes.attachment_link.title
DT L3 C7 Filtering  data and statistics for EDA with Python 24.04.2025

# data[].attributes.body
1) B

2) C

3) C

4) A

5) C

6) D

7) C

8) D

9) C

10) D

# data[].attributes.body
1) B

2) C

3) D

4) A

5) C

6) C

7) D

8) B

9) C

10) C

# data[].attributes.body
1 - B

2 - C

3 - C

4 - D incorrect - A is correct

5 - A incorrect - C is correct

6 - D

7 - C

8 - A incorrect - B is correct

9 - C

10 - D

# data[].attributes.body
df_Coffee = df[df['Product'] == "Coffee Maker"]
df_Coffee

# data[].attributes.body
df[df['Product'] == 'Coffee Maker']

# data[].attributes.body
df[df['Product']=='Coffee Maker']

# data[].attributes.headline
# display the transactions with the price smaller than 50

# data[].attributes.subject
# display the transactions with the price smaller than 50

# data[].attributes.body
df[df['Price'] < 50]

# data[].attributes.body
df[df['Price']<50]

# data[].attributes.body
df[df['Price']<50]

# data[].attributes.headline
# create a data frame with the values with price smaller than 50 and save it to file as a csv without index

# data[].attributes.subject
# create a data frame with the values with price smaller than 50 and save it to file as a csv without index

# data[].attributes.body
df1 = df[df['Price'] < 50]
df1.to_excel('df1.xlsx')

# data[].attributes.body
df2=df[df['Price']<50]

df2.to_csv('Priceunder50.csv', index = False)

# data[].attributes.body
df1 = df[df['Price'] < 50]
df1.to_csv('df1.csv', index=False)

# data[].attributes.headline
#find transactions from Electronics with Price >500

# data[].attributes.subject
#find transactions from Electronics with Price >500

# data[].attributes.body
electronics_sales = df[(df['Category'] == "Electronics") & (df['Price'] > 500)]
electronics_sales

# data[].attributes.body
Electronics=df[(df['Category']=='Electronics') & (df['Price']>500)]

Electronics

# data[].attributes.body
df[(df['Category'] == 'Electronics') & (df['Price'] > 500)]

# data[].attributes.body
1. Load And view the data

2. filter Employess marked as 'Late'

3. Filter Employess from It Department

4. Filter employes Absent on a Specific date

# data[].attributes.body
1: Load and View Data

2: Filter Failed Login Attempts

3: Find Login Attempts from a Specific IP Address

4: Filter Logins in a Time Range

# data[].attributes.body
1)

employee = pd.read_csv('employee_attendance.csv')
employee

2)

late_employees = employee[employee['Status'] == 'Late']
late_employees

3)

it_employees = employee[employee['Department'] == 'IT']
it_employees

4)

absent_employees = employee[(employee['Status'] == 'Absent') & (employee['Date'] == '2024-02-02')]
absent_employees

# data[].attributes.body
1. df3=pd.read_csv('employee_attendance.csv')

df3.info()

2. df3[df3['Status']=='Late']

3. df3[df3['Department']=='IT']

4. df3[(df3['Date']=='2024-02-02') & (df3['Status']=='Absent')]

# data[].attributes.body
df_attendance = pd.read_csv('employee_attendance.csv')
df_attendance

late_employees = df_attendance[df_attendance['Status'] == 'Late']
late_employees

it_employees = df_attendance[df_attendance['Department'] == 'IT']
it_employees

absent_employees = employee[(employee['Status'] == 'Absent') & (employee['Date'] == '2024-02-02)] absent_employees

# data[].attributes.body
1. df4=pd.read_csv('cybersecurity_logins.csv')

df4.info()

2. df4[df4['Success']=='No']

3. df4[df4['IP_Address']=='192.168.1.10']

4. Times=df4[(df4['Timestamp'] >= '2024-02-01 08:30:00') & (df4['Timestamp']<= "2024-02-01 12:00:00")]

Times

# data[].attributes.body
Dayo

df1=pd.read_csv('employee_attendance.csv')

df1

df1_late = df1[df1['Status'] == 'Late']

df1_late

df1_it = df1[df1['Department'] == 'IT']

df1_it

df1_absent = df1[(df1['Status'] 'Absent') & (df1['Date'] '2024-02-02')]

df1_absent

# data[].attributes.body
1)

df2 = pd.read_csv('cybersecurity_logins.csv')
df2

2)

failed_logins = df2[df2['Success'] == 'No']
failed_logins

3)

specific_ip_attempts = df2[df2['IP_Address'] == '192.168.1.10']
specific_ip_attempts

4)

time_range_attempts = df2[(df2['Timestamp'] >= '2024-02-01 08:30:00') & (df2['Timestamp'] <= '2024-02-01 09:10:00')]
time_range_attempts

# data[].attributes.body
Dayo

1

df2 = pd.read_csv('cybersecurity_logins.csv')

df2.info()

2

df2_unsuccessful = df2[df2['Success'] == 'No']

df2_unsuccessful

3

df2_ip_filtered = df2[df2['IP_Address'] == '192.168.1.10']

df2_ip_filtered

4

4

df2_time_filtered = df2[

(df2['Timestamp'] >= '2024-02-01 08:30:00') &

(df2['Timestamp'] <= '2024-02-01 12:00:00')]

df2_time_filtered

# data[].attributes.body
df3=pd.read_csv('cybersecurity_logins.csv')
df3

failed_logins = df3[df3['Success'] == 'No']
failed_logins

ip_address = '192.168.1.1'
login_attempts_from_ip = df3[df3['IP_Address'] == ip_address]
login_attempts_from_ip

time_range_attempts = df3[(df3['Timestamp'] >= '2024-02-01') & (df3['Timestamp'] <= '2024-02-05')]
time_range_attempts

# data[].attributes.body
 # COUNT
 # SUM
 # MIN
  # MAX

# data[].attributes.body
Measures of Center:

mean

median

mode

# data[].attributes.body
Standard deviation

The range

The Mean

# data[].attributes.headline
Correlation between Quantity and Revenue

# data[].attributes.subject
Correlation between Quantity and Revenue

# data[].attributes.body
r(Pearson coefficient)

Interpret the value of r

# data[].attributes.body
df['Price'].sum()
df['Price'].count()
df['Price'].min()
df['Price'].max()

# data[].attributes.body
df['Revenue'].count()

df['Revenue'].min()

df['Revenue'].max()

df['Revenue'].sum()

# data[].attributes.body
#print(f"Total number of prices present is {df['Price'].count()}")

#print(f"Total Price is {df['Price'].sum()}")

#print(f"Minimum revenue is {df['Price'].min()}")

#print(f"Maximum revenue is {df['Price'].max()}")

# data[].attributes.body
Dayo

print(f"Total price is {df['Price'].sum()} per year")

print(f"Total number of transactions is {df['Price'].count()} per year")

print(f"Min price is {df['Price'].min()}")

print(f"Max price is {df['Price'].max()}")

# data[].attributes.body
print(f"The average of price is {df['Price'].mean()}")

print(f"The Median of price is {df['Price'].median()}")

print(f"The most common price is {df['Price'].mode()}")

# data[].attributes.body
print(f"Mean Price is {df['Price'].Mean()}")
print(f"Median Price is {df['Price'].median()}")
print(f"Mode Price is {df['Price'].mode()}")

# data[].attributes.body
print(f"Mean Price: {df['Price'].mean()}")

print(f"Median Price: {df['Price'].median()}")

print(f"Mode of Price: {df['Price'].mode()[0]}")

# data[].attributes.body
print(f"Mean of Price is {df['Price'].mean()} per year")
print(f"Mode of Price {df['Price'].count()} per year")
print(f"Median of Price is {df['Price'].mode})

# data[].attributes.body
print(f"Range of Revenue is {df['Revenue'].max()- df['Revenue'].min()}")
print(f"Standard Deviation of revenue is {df['Revenue'].std()}")

# data[].attributes.body
print(f"Standard deviation of Revenue is {df['Revenue'].std()}")
print(f"Mean of Revenue {df['Revenue'].mean()}")
print(f"Range of Revenue is {df['Revenue'].max() - df['Revenue'].min()}")

# data[].attributes.body
Mean

print(f"Mean Revenue: {df['Revenue'].mean()}")

Standard Deviation

print(f"Standard Deviation of Revenue: {df['Revenue'].std()}")

Range

Revenue_range = df['Revenue'].max() - df['Revenue'].min()

print(f"Range of Revenue: {revenue_range}")

# data[].attributes.body
print(f"Standard Deviation of Revenue: {df['Revenue'].std()}")

print(f"Range of Revenue: {df['Revenue'].max()-df['Revenue'].min()}")

print(f"Mean Revenue: {df['Revenue'].mean()}")

# data[].attributes.body
r = df['Quantity'].corr(df['Price'])
r
print(f"Pearson correlation Coefficent: {r}")

# data[].attributes.body
r2 = df['Quantity'].corr(df['Revenue'])

r2

print(f'Pearson correlation Coefficient: {r2}')

# data[].attributes.body
r = df['Revenue'].corr(df['Quantity'])
r
print(f'Pearson correlation Coefficient: {r}')

# data[].attributes.body
r = df['Revenue'].corr(df['Quantity'])

r

print(f'Pearson correlation coefficient: {r}')

# data[].attributes.body
From last session, I knew how to create various charts such boxplots, line charts & more.

# data[].attributes.body
Memorising the code.

# data[].attributes.body
How to plot the charts, like bar/box/hist etc

# data[].attributes.body
From last session plotting and other visualisations have been enforced and mentioned more

# data[].attributes.body
Getting the code in the correct order/format. constantly missing commas and having to go back and fix them

# data[].attributes.body
I knew about making graphs and different visualisations, but alot of it was new but very informative

# data[].attributes.body
Instead of using power BI, i will try to create charts and cleanse data from python.

# data[].attributes.body
To see the code and utilise it with its differing challenges

# data[].attributes.body
I feel satisfied with what i've learnt this lesson.

# data[].attributes.body
I plan to use density plots for the digital acquisitions manager to show the frequency and average of commissions from sales

# data[].attributes.body
Being able to remember all the specific codes was fairly difficult but with more study and repetition i should be able to gather more.

# data[].attributes.body
To Reinforce my knowledge with Python i will use google colab more often

# data[].attributes.body
It Has been an engaging and interesting session, with more plots to explore and remember.

# data[].attributes.body
It's really interesting, can be utilised in much more depth than power BI

# data[].attributes.body
im looking to implement more python in my day to day and to increase my knowledge in it as i can help me streamline my work more

# data[].attributes.body
Been a very insightful session and has sparked my interest inn pythons capabilities more

# data[].attributes.body
1. C

2. C

3. C

4. D

5. C

6. D

7. C

8. B

9. D

10. B

# data[].attributes.body
1) C

2) C

3) C

4) B

5) C

6) C

7) C

8) B

9) D

10) C