I have a CSV file with no header in a single and it contains data like this
25 35 56 45
what I am looking to do in spyder is
STEP 1: Import the csv file and store these vales in myArray.
import pandas
filename = 'myfile.csv'
myArray = pandas.read_csv(filename)
print(myArray)
STEP 2: convert the myArray indices to 4 bit binary numbers and export it in new CSV file.
[0,0,0,0;
0,0,0,1;
0,0,1,0;
0,0,1,1]
Can anybody help me converting the array indices to binary data like this?
for k in range(1, 512):
print (list('{0:8b}'.format(k)))
when i run this code it gives me output like
[' ', ' ', ' ', ' ', ' ', ' ', ' ', '1']
[' ', ' ', ' ', ' ', ' ', ' ', '1', '0']
[' ', ' ', ' ', ' ', ' ', ' ', '1', '1']
[' ', ' ', ' ', ' ', ' ', '1', '0', '0']
but I want it like ['0', '0', '0', '0', '0', '0', '0', '1'] and export this in csv file as number