AttributeError: 'Pandas' object has no attribute 'DataFrame'
<p>I'm trying to write each row of a slice from a dataframe object to a new csv using the to_csv method in pandas.DataFrame within an itertuples() loop. However, whenever I invoke DataFrame on the row object I get the following error.</p>

<p>AttributeError: 'Pandas' object has no attribute 'DataFrame'</p>

<p>Other questions regarding the same error indicate that this is either do to:</p>

<p>1) mis-capitalization of DataFrame, i.e. dataframe, or Dataframe
2) or a problem with pandas itself, a error during installation etc. </p>

<p>I know that it is not 1) because I have written it DataFrame, as seen in the error message. Furthermore, I don't expect it to be 2) because I can run pandas.read_csv to import dataframes and then run methods on these objects without any problem. </p>

<p>So, my questions are: </p>

<p>1) is there another possible source to the problem, perhaps deriving from trying to apply the method on a row in a loop? </p>

<p>2) how can I verify that pandas and all its methods are installed properly? so that I can eliminate 2) as a possibility. </p>

<pre><code>for row in df.itertuples():
        if not os.path.isfile(path):
           row.DataFrame.to_csv(path, index=False, mode='w', header=headers)
        elif os.path.isfile(path):
           row.DataFrame.to_csv(path, index=False, mode='a')

AttributeError                            Traceback (most recent call last)
&lt;ipython-input-192-0af973f1c147&gt; in &lt;module&gt;()
     39                         row.DataFrame.to_csv(path, index=False, mode='w
, header=headers)
     40                 elif os.path.isfile(path):
---&gt; 41                         row.DataFrame.to_csv(path, index=False, mode='a
)

AttributeError: 'Pandas' object has no attribute 'DataFrame'
</code></pre>

<p>I have tried eliminating the itertuples() loop and replacing with a function applied to the data frame. The function is:</p>

<pre><code>df.apply(lambda x: df.loc[x].to_csv(''.join([dir,'-'.join([df.iloc[x][3],df.iloc[x][5],df.iloc[x][4],df.iloc[x][0]]),'.csv'])
</code></pre>

<p>The nested join methods compose the path from values within each row. I have tested this for various rows and it works fine, but now I am getting the following error on the line with the function: </p>

<pre><code>type error: ('unorderable types: str() &gt;= int()', 'occurred at index 0') 
</code></pre>

<p>What does this mean? What is it trying to order and why?</p>