I have an empty existing dataframe with columns
In[337]: df_short_interests.columns
Out[337]:
Index(['Settlement Date', 'Short Interest', 'Avg Daily Share Volume',
'Days To Cover'],
dtype='object')
I have a list below which I would like to add as a row to the dataframe.
row_data = []
row_data.append('2/15/2019')
row_data.append('39,903,215')
row_data.append('26,937,971')
row_data.append('1.481300')
I tried to add the list with the below code and I got warning and the list get added as a column instead.
In[334]:df_short_interests.append(row_data, ignore_index=True)
C:\Users\user\Anaconda3\lib\site-packages\pandas\core\indexes\api.py:107: RuntimeWarning: '<' not supported between instances of 'str' and 'int', sort order is undefined for incomparable objects
result = result.union(other)
Out[334]:
Settlement Date Short Interest ... Days To Cover 0
0 NaN NaN ... NaN 2/15/2019
1 NaN NaN ... NaN 39,903,215
2 NaN NaN ... NaN 26,937,971
3 NaN NaN ... NaN 1.481300
How can I add the list a row instead of a column?
Thank you.