I have the following code:
import csv
import pandas as pd
import numpy as np
df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
for x in range(10, 11):
df.to_csv("file_%x.csv" % x, index=False)
Instead of returning file_10.csv, the code returns file_a.csv. Why is this happening? I checked the value of x in the loop and it is indeed 10, so why is it being converted to 'a'?