<jupyter_start><jupyter_text>Practice with `numpy`! **Remember:*** Numpy provides a bunch of useful tools for performing calculations* You access numpy functions by calling `np.function_name` First, __import numpy__. Remember to use the nickname!<jupyter_code># load numpy<jupyter_output><empty_output><jupyter_text>Use numpy to __create a list of numbers from 0 through 99.__ We'll use a function called __`arange`.__<jupyter_code># Use np.arrange to generate an array of numbers and assign it to a variable called numbers

# print the array to see what it looks like<jupyter_output><empty_output><jupyter_text>Now use numpy's function called __`zeros`__ to __create another empty array__ of the same size:<jupyter_code># Create an empty array with np.zeros and assign it to a variable

# print it<jupyter_output><empty_output><jupyter_text>Now try manipulating the arrays using basic math:<jupyter_code># Add the numbers array to itself


# Multiply the numbers array to itself<jupyter_output><empty_output><jupyter_text>Note that when you perform a math operation on an array, __it will often perform that operation on each item in that array.__ It's convenient that __we don't have to loop through all the values__ to apply the math operation to every item in the array. __You can find information about the size of an array by using `.shape`.__ Note that `.shape` is an *attribute* of array -- a special variable that belongs to every *array object*. Try it out:*HINT*: Because `.shape` is not a function you don't need to use parentheses.<jupyter_code># Use shape to view the size of your array<jupyter_output><empty_output><jupyter_text>`.shape` gave us just one number, because our array has only 1 dimension. Later we'll see what it looks like for arrays with more than 1 dimension.Numpy also allows you to create 2D arrays, like with lists. We can __use the `method` called `reshape` to change an 1-dimensional `array` into a 2-dimensional `array`.__ `reshape` takes two arguments: the number of rows and the number of columns. Try turning one of your arrays into a 2D array using `reshape`.<jupyter_code># Reshape one of your arrays into a 2D array

# print out the array<jupyter_output><empty_output><jupyter_text>Now the `.shape` of your array should be changed, __try printing it out below:__<jupyter_code># Print the shape of your new array<jupyter_output><empty_output><jupyter_text>Now we will try a couple of numpy's math functions!<jupyter_code># try using np.sum to add the items in a list together


# try squaring the value of each item in your array<jupyter_output><empty_output><jupyter_text>__Try converting the `numbers` array to an array of floats__ using the method called `astype`:<jupyter_code># Convert the array into an array of floats<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06578476939578119, 'fraction_numerical': 0.003575259206292456, 'mean_word_length': 5.646080760095012, 'pattern_counts': {'":': 0, '<': 37, '<?xml version=': 0, '>': 37, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '9', 'dir': 'jupyter-structured-clean-dedup', 'id': '511262', 'license': 'CC-BY-4.0', 'n_tokens_mistral': 827, 'n_tokens_neox': 795, 'n_words': 381, 'path': 'Practices/Practice20_Numpy_Intro.ipynb', 'repo_name': 'lechten/curriculum-notebooks', 'size': '2797'}