0

if I do:

import numpy as np

arr1=np.tile(0.75, 32)

I get a 32 element array of float64 initialized with the value 0.75.

How to do the same but get a float32 array?

Zibri
  • 9,096
  • 3
  • 52
  • 44

1 Answers1

0

All suggestion work but my program clearly was not related to this but to the soundfile library. Anyway:

Solutions are:

np.tile(0.75, 32).astype(np.float32)

or

np.full(32, 0.75, dtype=np.float32)    # **FASTEST**

or

np.ones(32)*0.75
Zibri
  • 9,096
  • 3
  • 52
  • 44