What are the steps to post a Pandas dataframe in a Stack Overflow question?
I found: How to make good reproducible pandas examples.
I followed the instructions and used pd.read_clipboard, but I still had to spend a significant amount of time formatting the table to make it look correct.
I also found: How to display a pandas dataframe on a Stack Overflow question body.
I tried to copy the dataframe from Jupyter and paste it into a Blockquote. As mentioned, I also ran pd.read_clipboard('\s\s+') in Jupyter to copy it to the clipboard and then pasted it into a Blockquote.
I also tried creating a table and pasting the values in the table.
All of these methods required that I tweak the formatting to make it look properly formatted.
An example dataframe:
df = pd.DataFrame(
[['Captain', 'Crunch', 72],
['Trix', 'Rabbit', 36],
['Count', 'Chocula', 41],
['Tony', 'Tiger', 54],
['Buzz', 'Bee', 28],
['Toucan', 'Sam', 38]],
columns=['first_name', 'last_name', 'age'])
print(df)? It doesn't work withsep=r'\s\s+', but your data doesn't contain any whitespace, so you can just usesep=r'\s+'.read_clipboardmakes the numbers into strings? That's one reason I pointed out the "runnable code" above.