I am using Jenkins to automatically update a table on the following page: https://www.synapse.org/#!Synapse:syn7077749/wiki/402516 You will see, if you look at my code, that the start anchor disappears after this table is loaded/updated on the wiki. Note that this doesn't impact my stop anchor. I don't think I'm doing anything wrong, but if I am, please let me know. Thanks! ``` # -*- coding: utf-8 -*- #!/usr/bin/env python import synapseclient import pandas as pd #import numpy as np syn=synapseclient.Synapse() syn.login() def determineNewSampleCount(synID_in,synID_out,wikiPage,row,column,ID): # Import data my_entity=syn.get(synID_in) df = pd.read_csv(my_entity.path,low_memory=False) # Create a grouped dataframe (like pivot table) df=df[[row,column,ID]] grouped=df.groupby([row,column]).count().unstack() return(grouped) # Display basic sample counts on test wiki page synID_in='syn2299154' synID_out='syn7077749' wikiPage=402516 row='Institution' column='Gender' ID='Individual ID' # Format wiki wiki = syn.getWiki(synID_out,wikiPage) table = determineNewSampleCount(synID_in,synID_out,wikiPage,row,column,ID) tablestr = table.to_csv(sep='|') startIndex = wiki.markdown.index('Practice_Summary_Table') endIndex = wiki.markdown.index('practice_endpoint') wiki.markdown = '%s\n%s\n%s' %(wiki.markdown[:startIndex], tablestr, wiki.markdown[endIndex:]) syn.store(wiki) ```

Created by Laura Sloofman lauragails
Thanks, Larsson. Problem solved!
Hi Laura: wiki.markdown.index will return the first index of your string. For example if you have the string ``` string: abcdefg index: 0123456 ``` and you call string.index('ef') it will return 4 while you want to insert your new string after 5. That is you need to generate your markdown using: ``` wiki.markdown = '%s\n%s\n%s' %(wiki.markdown[:startIndex+len('Practice_Summary_Table')], tablestr, wiki.markdown[endIndex:]) ```

Systematic table placement on wiki page bugs page is loading…