I created the below script to help pipeline data from a csv file which consists of list of attributes of a county to pandas DataFrame and then to a feature class located in a SQL Server database. The cvs file consists of columns names which match with some of the field names in the feature class to help map the columns to the fields while loading the data.
The class I used is: InsertCursor. Before the input rows are given to the InsertCursor method, it is converted to a list using the values.list() method as InsertCursor expects a list or a tuple if its not for a single field. In the below script I am adding a subset of 100 rows and 3 columns, but you can insert and entire single column without actually having to convert it to a list. For eg: df['column-name'] where the column-name refers to one of the columns of the DataFrame can be inserted to the matching field in the feature class with all the column features.
The other ways of adding/ updating data is using UpdateCursor and/ or using combination of SearchCursor with either Update or Insert.
<SPAN class="keyword token">import</SPAN> arcgis
<SPAN class="keyword token">import</SPAN> pandas <SPAN class="keyword token">as</SPAN> pd
<SPAN class="keyword token">import</SPAN> arcpy
<SPAN class="keyword token">from</SPAN> arcpy <SPAN class="keyword token">import</SPAN> env
<SPAN class="keyword token">import</SPAN> os
<SPAN class="comment token">#Import the csv to pandas dataframe</SPAN>
pd<SPAN class="punctuation token">.</SPAN>set_option<SPAN class="punctuation token">(</SPAN><SPAN class="string token">'display.max_columns'</SPAN><SPAN class="punctuation token">,</SPAN> None<SPAN class="punctuation token">)</SPAN>
df <SPAN class="operator token">=</SPAN> pd<SPAN class="punctuation token">.</SPAN>read_csv<SPAN class="punctuation token">(</SPAN>r<SPAN class="string token">'<File_Name>.csv'</SPAN><SPAN class="punctuation token">,</SPAN> dtype<SPAN class="operator token">=</SPAN>str<SPAN class="punctuation token">,</SPAN> sep<SPAN class="operator token">=</SPAN><SPAN class="string token">'|'</SPAN><SPAN class="punctuation token">,</SPAN> encoding <SPAN class="operator token">=</SPAN> <SPAN class="string token">"ISO-8859-1"</SPAN><SPAN class="punctuation token">)</SPAN>
df<SPAN class="punctuation token">.</SPAN>head<SPAN class="punctuation token">(</SPAN><SPAN class="number token">20</SPAN><SPAN class="punctuation token">)</SPAN>
<SPAN class="comment token">#Subset of DataFrame consisting of 3 columns and 100 rows each</SPAN>
inputs <SPAN class="operator token">=</SPAN> df<SPAN class="punctuation token">.</SPAN>loc<SPAN class="punctuation token">[</SPAN><SPAN class="number token">0</SPAN><SPAN class="punctuation token">:</SPAN><SPAN class="number token">100</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="punctuation token">[</SPAN><SPAN class="string token">'column1'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'column2'</SPAN><SPAN class="punctuation token">,</SPAN> <SPAN class="string token">'column3'</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">]</SPAN><SPAN class="punctuation token">.</SPAN>values<SPAN class="punctuation token">.</SPAN>tolist<SPAN class="punctuation token">(</SPAN><SPAN class="punctuation token">)</SPAN>
fields <SPAN class="operator token">=</SPAN> <SPAN class="punctuation token">[</SPAN><SPAN class="string token">'field1'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'field2'</SPAN><SPAN class="punctuation token">,</SPAN><SPAN class="string token">'field3'</SPAN><SPAN class="punctuation token">]</SPAN>
env<SPAN class="punctuation token">.</SPAN>overwriteOutput <SPAN class="operator token">=</SPAN> <SPAN class="token boolean">True</SPAN>
env<SPAN class="punctuation token">.</SPAN>workspace <SPAN class="operator token">=</SPAN> r<SPAN class="string token">"X:\<sde location>"</SPAN>
fcname <SPAN class="operator token">=</SPAN> <SPAN class="string token">"Feature Class"</SPAN>
fc <SPAN class="operator token">=</SPAN> os<SPAN class="punctuation token">.</SPAN>path<SPAN class="punctuation token">.</SPAN>join<SPAN class="punctuation token">(</SPAN>env<SPAN class="punctuation token">.</SPAN>workspace<SPAN class="punctuation token">,</SPAN>fcname<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">try</SPAN><SPAN class="punctuation token">:</SPAN>
InsertCursor <SPAN class="operator token">=</SPAN> arcpy<SPAN class="punctuation token">.</SPAN>da<SPAN class="punctuation token">.</SPAN>InsertCursor<SPAN class="punctuation token">(</SPAN>fc<SPAN class="punctuation token">,</SPAN>fields<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">for</SPAN> row <SPAN class="keyword token">in</SPAN> inputs<SPAN class="punctuation token">:</SPAN>
InsertCursor<SPAN class="punctuation token">.</SPAN>insertRow<SPAN class="punctuation token">(</SPAN>row<SPAN class="punctuation token">)</SPAN>
<SPAN class="keyword token">except</SPAN> TypeError <SPAN class="keyword token">as</SPAN> e<SPAN class="punctuation token">:</SPAN>
<SPAN class="keyword token">print</SPAN><SPAN class="punctuation token">(</SPAN>f<SPAN class="string token">'A TypeError has occurred: {e}'</SPAN><SPAN class="punctuation token">)</SPAN><SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN><SPAN></SPAN></SPAN>