<jupyter_start><jupyter_text>Write a NumPy program to create an array of 10 zeros,10 ones, 10 fives. Write a  NumPy program to create an array of the integers from 30 to70.<jupyter_code>import numpy as np
a=np.zeros(10)
print("An array of 10 zeros:")
print(a)
b=np.ones(10)
print("An array of 10 ones:")
print(b)
c=np.ones(10)*5
print("An array of 10 fives:")
print(c)
import numpy as np
A=np.arange(30,71)
print("Array of the integers from 30 to70")
print(A)<jupyter_output>Array of the integers from 30 to70
[30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70]<jupyter_text>Write a NumPy program to create a vector with values ranging from 15 to 55 and  print all values except the first and last.<jupyter_code>import numpy as np
v = np.arange(15,55)
print("Original vector:")
print(v)
print("All values except the first and last of the said vector:")
print(v[1:-1])<jupyter_output>Original vector:
[15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54]
All values except the first and last of the said vector:
[16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
 40 41 42 43 44 45 46 47 48 49 50 51 52 53]<jupyter_text>Write a NumPy program to create a vector with values from 0 to 20 and change the  sign of the numbers in the range from 9 to 15.<jupyter_code>import numpy as np
x = np.arange(21)
print("Original vector:")
print(x)
print("After changing the sign of the numbers in the range from 9 to 15:")
x[(x >= 9) & (x <= 15)] *= -1
print(x)<jupyter_output>Original vector:
[ 0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20]
After changing the sign of the numbers in the range from 9 to 15:
[  0   1   2   3   4   5   6   7   8  -9 -10 -11 -12 -13 -14 -15  16  17
  18  19  20]<jupyter_text>Write a NumPy program to compute the x and y coordinates for points on a sine  curve and plot the points using matplotlib.<jupyter_code>import numpy as np
import matplotlib.pyplot as plt
# Compute the x and y coordinates for points on a sine curve
x = np.arange(0, 3 * np.pi, 0.2)
y = np.sin(x)
print("Plot the points using matplotlib:")
plt.plot(x, y)
plt.show()<jupyter_output>Plot the points using matplotlib:<jupyter_text>Write a NumPy program to create a random 10x4 array and extract the first five  rows of the array and store them into a variable. (hint: using numpy random module)<jupyter_code>import numpy as np
x = np.random.rand(10, 4)
print("Original array: ")
print(x)
y= x[:5, :]
print("First 5 rows of the above array:")
print(y)<jupyter_output>Original array: 
[[0.19265467 0.5756426  0.89399201 0.05130587]
 [0.74306917 0.43552039 0.29830888 0.30487663]
 [0.1407833  0.64998473 0.45819264 0.84668311]
 [0.21028294 0.15344292 0.79119989 0.17438954]
 [0.76761633 0.78140277 0.27410713 0.82902253]
 [0.23609822 0.28925324 0.10204846 0.90956092]
 [0.56910773 0.85609199 0.4574298  0.85186592]
 [0.42765974 0.16300718 0.91436226 0.65231969]
 [0.14944378 0.94057831 0.97500069 0.89333486]
 [0.92871425 0.3173369  0.07118987 0.85760502]]
First 5 rows of the above array:
[[0.19265467 0.5756426  0.89399201 0.05130587]
 [0.74306917 0.43552039 0.29830888 0.30487663]
 [0.1407833  0.64998473 0.45819264 0.84668311]
 [0.21028294 0.15344292 0.79119989 0.17438954]
 [0.76761633 0.78140277 0.27410713 0.82902253]]<jupyter_text>Draw flowing graph using matplotlib:  ![image.png](attachment:image.png)<jupyter_code>import matplotlib.pyplot as plt
import numpy as np
x = np.linspace(0,50,100)
y = 3*x
plt.plot(x, y, label='y=3x')
plt.title('Draw a line')
plt.xlabel('x- axis')
plt.ylabel('y-axis')
plt.show()<jupyter_output><empty_output><jupyter_text>Write a Pandas program to get the powers of an array values element-wise.<jupyter_code>import pandas as pd
C = pd.DataFrame({'X':[78,85,96,80,86], 'Y':[84,94,89,83,86],'Z':[86,97,96,72,83]});
print(C)<jupyter_output>X   Y   Z
0  78  84  86
1  85  94  97
2  96  89  96
3  80  83  72
4  86  86  83
{'fraction_non_alphanumeric': 0.10315684812329108, 'fraction_numerical': 0.24484215759383546, 'mean_word_length': 4.011207970112079, 'pattern_counts': {'":': 0, '<': 24, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '7', 'dir': 'jupyter-structured-clean-dedup', 'id': '185009', 'license': 'MIT', 'n_tokens_mistral': 2265, 'n_tokens_neox': 1564, 'n_words': 600, 'path': 'Python-Libraries/submissions/RITIKA1201.ipynb', 'repo_name': 'kashika0112/ML-Circle-20-21', 'size': '4023'}