In order to test some functionality I would like to create a DataFrame from a string. Let\'s say my test data looks like:
TESTDATA=\"\"\"col1;co
Simplest way is to save it to temp file and then read it:
import pandas as pd
CSV_FILE_NAME = 'temp_file.csv' # Consider creating temp file, look URL below
with open(CSV_FILE_NAME, 'w') as outfile:
outfile.write(TESTDATA)
df = pd.read_csv(CSV_FILE_NAME, sep=';')
Right way of creating temp file: How can I create a tmp file in Python?