Practice exercise
Read the (x,y) coordinates of a vector (v1
and an angel of rotatation (α[°]
Rotate the vector v1
with the given angle α
and print the (x,y) coordinates of the rotated vector (v2
on the console.
2D rotational matrix:
R=[cos(α)sin(α)−sin(α)cos(α)]Rotata the vector (v1
with the given angle:v2=R⋅v1Create an 4×6 array filled with random numbers from the [-10,10] interval. Replace all 0 items with average of the array values.
Open the “KSH_FelsOkt_90_22.csv” file.
a. – Print on the console the content of the dataframe based on column titles. Print all column title in a separate line.
b. – Print all data of those years when the most amount of people and least amount of people applied for higher education.
c. – Write on the console the average number of students enrolled in higher education between 2010 and 2015.
d. – Graph the number of students applied and enrolled by year.
Open the “Alcohol_consumption.csv” file using the PANDAS module.
a. – Print all information about the dataframe on the console (row labels, column labels, datatypes, non-zero values, memory usage).
b. – Print the sum of alchol consuption by beverage types on the console.
c. – Print the data from each row with the maximum consumption value by beverage types.
d. – Arrange the dataframe in ascending order based on consumption data.
e. – Select the lines in the dataframe where a data field is empty. If the alcohol consumption rate is missing, enter the average consumption rate for that alcohol type in the field. Otherwise, delete the row.
f. – Plot alcohol consumption by type of alcohol on a bar chart
make sure to use numpy and pandas if it can be