Skip to content

Python Advent Calendar Challenge - Data Science Edition. These challenges aim to make you familiar with various numpy and pandas functions.

Notifications You must be signed in to change notification settings

kyleecodes/Python-Advent-Calendar

Repository files navigation

Python Advent Calendar Challenge - Data Science Edition! 24 challenges for 24 days :)

Date Challenge
Dec01 Write a function called generate_arr(start, end) that takes as input two integers start, end and returns a NumPy array (1 dimensional) containing all integers between those values including start and end.
Dec02 Missing data is an everyday problem that data scientists need to deal with. Write a function called replace_nans(array) that takes as input a NumPy array and returns it after replacing all np.nan (numpy.nan) values with -1.
Dec03 Write a funtion called generate_matrix_9x9() that generates a 9x9 matrix with all elements equal 2 except the one in the middle which should be equal 0.
Dec04 Write a funtion called get_elements(arr) that returns the median of all the elements of the input array which are greater than 2.
Dec05 Write a function called compute_percentage_unique_elements(arr) that returns the percentage of all unique entries of an array (as float).
Dec06 Write a function called half_xmas_tree(depth) that takes as argument an integer and prints half of a christmas tree of given depth using 1s (for the xmas tree) and 0s (for the background).
Dec07 Write a function called weighted_average(arr) that returns the weighted average of an input array where all elements besides the first and the last have the same weight and the weight of the 2 remaining ones is 5x bigger.
Dec08 Write a funtcion called calculate_magda_metric(arr) that takes as input a matrix and computes magda_metric which is the mean of the values in the first column multiplied by the sum of the values in the last row.
Dec09 Write a function called initialize_weights(rows, columns) that returns a rows x columns matrix containing weights which are random uniform distributed over the half-open interval.
Dec10 Write a function called can_multiply(m1, m2) that takes as input a x b matrix m1 and c x d matrix m2 and returns true if it is possible to multiply m1 and m2 and false otherwise.
Dec11 Write a function called multiply_with_transpose(m) that returns matrix m multiplied with its transpose.
Dec12 Write a function called create_series(data) that takes as input a dictionary and converts it to a Pandas series.
Dec13 Write a function called create_and_sort_series(data) that takes as input a list of values, converts it to a Series, adds value 2 to the series, and returns a sorted version of it (descending!).
Dec14 Write a function called occurrences(data) that converts data (a dictionary) into series and returns the frequency count of of every number in this series.
Dec15 Write a function called where_is_2(series) that returns the position (integer) of the number 2
Dec16 Write a function called get_joining_date(data) that takes as input a dictionary, turns it into Pandas dataframe, sets name as index, and returns the date on which Peter has joined the challenge.
Dec17 "ser" has missing dates and values, make all missing dates appear and fill up with value from previous dates
Dec18 Compute autocorrelations for the first 10 lags of ser. Find out which lag has the largest correlation.
Dec19 Import every 50th row of BostonHousing dataset as a dataframe.
Dec20 Filter words that contain at least 2 vowels from a series.
Dec21 Filter non-emails from a series of emails.
Dec22 Find all the local maxima (or peaks) in a numeric series.
Dec23 Use the apply function on existing columns with global variables as additional arguments.
Dec24 Create a new column that contains the row number of nearest column by euclidean distance.

About

Python Advent Calendar Challenge - Data Science Edition. These challenges aim to make you familiar with various numpy and pandas functions.

Resources

Stars

Watchers

Forks

Languages