# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

# # [How do I provide a reproducible copy of my existing DataFrame?](https://stackoverflow.com/questions/52413246/how-do-i-provide-a-reproducible-copy-of-my-existing-dataframe/52413247#52413247)
#
#

import pandas as pd
from pprint import pprint as pp

# ## Create your DataFrame from some file

df = pd.read_csv('data/2018-09-18_flavors_of_cacao.csv')

df.head()

# # Easiest Method

# ## Using to_clipboard and read_clipboard

df.head(10).to_clipboard(sep=',', index=False)

# If you have a multi-index DataFrame or an index other than 0...n, use <b>index=True</b> and provide a note in your question as to which column(s) are the index.

# ## output of to_clipboard

"Company 
(Maker-if known)","Specific Bean Origin
or Bar Name",REF,"Review
Date","Cocoa
Percent","Company
Location",Rating,"Bean
Type","Broad Bean
Origin"
<NAME>,<NAME>,1876,2016,63%,France,3.75, ,Sao Tome
<NAME>,Kpime,1676,2015,70%,France,2.75, ,Togo
<NAME>,Atsane,1676,2015,70%,France,3.0, ,Togo
<NAME>,Akata,1680,2015,70%,France,3.5, ,Togo
<NAME>,Quilla,1704,2015,70%,France,3.5, ,Peru
<NAME>,Carenero,1315,2014,70%,France,2.75,Criollo,Venezuela
<NAME>,Cuba,1315,2014,70%,France,3.5, ,Cuba
<NAME>,Sur del Lago,1315,2014,70%,France,3.5,Criollo,Venezuela
<NAME>,<NAME>,1319,2014,70%,France,3.75,Criollo,Venezuela
<NAME>,Pablino,1319,2014,70%,France,4.0, ,Peru

# ## after executing to_clipboard, run pd.read_clipboard

pd.read_clipboard(sep=',')

# # With Lists

# ## pretty print the headers

pp(list(df.columns))

# ## create a variable, copy the printed headers and assign the copy
# ### this can then be copied and pasted into Stack Overflow

sof_headers = ['Company\xa0\n(Maker-if known)',
 'Specific Bean Origin\nor Bar Name',
 'REF',
 'Review\nDate',
 'Cocoa\nPercent',
 'Company\nLocation',
 'Rating',
 'Bean\nType',
 'Broad Bean\nOrigin']

# ## pretty print some small range of the DataFrame values

pp(df.iloc[0:10].values)

# ## create a variable, copy the printed values and assign the copy
# ### this can be copied and pasted into Stack Overflow

sof_values = [['<NAME>', '<NAME>', 1876, 2016, '63%', 'France', 3.75,
        '\xa0', 'Sao Tome'],
       ['<NAME>', 'Kpime', 1676, 2015, '70%', 'France', 2.75, '\xa0',
        'Togo'],
       ['<NAME>', 'Atsane', 1676, 2015, '70%', 'France', 3.0, '\xa0',
        'Togo'],
       ['<NAME>', 'Akata', 1680, 2015, '70%', 'France', 3.5, '\xa0',
        'Togo'],
       ['<NAME>', 'Quilla', 1704, 2015, '70%', 'France', 3.5, '\xa0',
        'Peru'],
       ['<NAME>', 'Carenero', 1315, 2014, '70%', 'France', 2.75,
        'Criollo', 'Venezuela'],
       ['<NAME>', 'Cuba', 1315, 2014, '70%', 'France', 3.5, '\xa0',
        'Cuba'],
       ['<NAME>', '<NAME>', 1315, 2014, '70%', 'France', 3.5,
        'Criollo', 'Venezuela'],
       ['<NAME>', '<NAME>', 1319, 2014, '70%', 'France', 3.75,
        'Criollo', 'Venezuela'],
       ['<NAME>', 'Pablino', 1319, 2014, '70%', 'France', 4.0, '\xa0',
        'Peru']]

# ## Using sof_values and sof_headers, the Stack Overflow community can easily reproduce your DataFrame and more easily answer your question

sof_df = pd.DataFrame(sof_values, columns=sof_headers)

sof_df

StarcoderdataJupyterScriptsDedupFiltered