<jupyter_start><jupyter_text>创建特殊数组<jupyter_code># 等差数组
arr4=np.arange(0,5,1)
print(arr4)
arr5=np.arange(8,1,-1)
print(arr5)
# 全零数组
arr6 = np.zeros(10)
print(arr6)
# 全一数组
arr7 = np.ones(8)
print(arr7)
# 经常用到的方法 快速生成二维全是1的数组
arr8 = np.ones(12).reshape(3,4)
print(arr8)<jupyter_output>[0. 0. 0. 0. 0. 0. 0. 0. 0. 0.]
[1. 1. 1. 1. 1. 1. 1. 1.]
[[1. 1. 1. 1.]
 [1. 1. 1. 1.]
 [1. 1. 1. 1.]]<jupyter_text>随机数模块 * 种子固定输出结果-ipython中固定一个文本框的结果，py中固定一个py文件的结果<jupyter_code>np.random.seed(100)<jupyter_output><empty_output><jupyter_text>* 标准正态分布的数据 -均值为0，标准差为1<jupyter_code># 3行3列
# np.random.seed(100)
data1 = np.random.randn(3,3)
print(data1)<jupyter_output>[[-0.43813562 -1.11831825  1.61898166]
 [ 1.54160517 -0.25187914 -0.84243574]
 [ 0.18451869  0.9370822   0.73100034]]<jupyter_text>* 随机整数<jupyter_code># 1-100以内，生成3行5列随机整数 
np.random.seed(100)
data2 = np.random.randint(1,100,[3,5])
print(data2)<jupyter_output>[[ 9 25 68 88 80]
 [49 11 95 53 99]
 [54 67 99 15 35]]<jupyter_text>* 0-1范围内的随机实数<jupyter_code># 10 个 0-1范围内的随机实数
data3=np.random.random(10).reshape(2,5)
print(data3)<jupyter_output>[[0.10837689 0.21969749 0.97862378 0.81168315 0.17194101]
 [0.81622475 0.27407375 0.43170418 0.94002982 0.81764938]]
{'fraction_non_alphanumeric': 0.18460264900662252, 'fraction_numerical': 0.24503311258278146, 'mean_word_length': 4.985148514851486, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 17, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '436629', 'license': 'Apache-2.0', 'n_tokens_mistral': 878, 'n_tokens_neox': 739, 'n_words': 100, 'path': 'month06/DATASCIENCE/DS_day01/DS_day01_all_code/.ipynb_checkpoints/03_numpy_ndarry-checkpoint.ipynb', 'repo_name': 'chaofan-zheng/python_learning_code', 'size': '1208'}