how to keep pd.read_csv() from changing datatype
<p>I save a DataFrame using to_csv(), then retrieve it with csv_read() and it comes back with a different datatype.</p>

<pre><code>df1i=['00','01']
df1=pd.DataFrame( columns=['00','01'],index=df1i)
df1
df1.iloc[0,0]=([11, 22])
df1
print((df1.iloc[0,0]))
print(type(df1.iloc[0,0]))
print(df1.iloc[0,0][0])
print(type(df1.iloc[0,0][0]))
df1.to_csv('C:\Thomas\paradigm\\df1.csv') 
df1=pd.read_csv('c:\\Thomas\\paradigm\\df1.csv',index_col=0)
print((df1.iloc[0,0]))
print(type(df1.iloc[0,0]))
print(df1.iloc[0,0][0])
print(type(df1.iloc[0,0][0]))

[11, 22]
&lt;class 'list'&gt;
11
&lt;class 'int'&gt;
[11, 22]
&lt;class 'str'&gt;
[
&lt;class 'str'&gt;
</code></pre>

<p>If anyone can tell me how to control this I will appreciate it.</p>

<p>Clarification of my question>>></p>

<p>What I am asking is if there is a way to get back the same type that you put in. For instance, if I input the element as an integer, it comes back as a string, an ndarray in also comes back as a string.</p>

<p>It is a bit weird to store lists as elements of a DataFrame, but if it is what you need to do then consider using a converter along with <code>ast.literal_eval</code> in order to get a list back. </p>

<pre><code>import pandas as pd
import ast


df1i = ['00', '01']
df1=pd.DataFrame( columns=['00','01'],index=df1i)
df1.iloc[0,0]=([11, 22])

print((df1.iloc[0,0]))
print(type(df1.iloc[0,0]))
print(df1.iloc[0,0][0])
print(type(df1.iloc[0,0][0]))

df1.to_csv('df1.csv')

df1=pd.read_csv('df1.csv', index_col=0, converters={'00': lambda x: ast.literal_eval(str(x)) if len(str(x)) &gt; 0 else x})

print((df1.iloc[0,0]))
print(type(df1.iloc[0,0]))
print(df1.iloc[0,0][0])
print(type(df1.iloc[0,0][0]))
</code></pre>

python