You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When uploading data to CARTO via CartoFrames' Dataset.upload() method, double quotes are removed. Single quotes are not. This is probably somewhat related to https://github.com/CartoDB/support/issues/2219.
An example can be seen here:
importpandasaspdfromcartoframes.dataimportDatasetdf=pd.DataFrame({
'a': [
'This is a string with "double quotes"',
"This is a string with 'single quotes'"
]
})
Dataset(df).upload(table_name='testing_quotes', if_exists='replace')
When looking at the original Pandas' DataFrame, double quotes are correctly managed:
print(df['a'])
0 This is a string with "double quotes"
1 This is a string with 'single quotes'
Name: a, dtype: object
If we use the DataFrame's internal .to_csv() method, double quotes are correctly escaped by doubling them up:
df.to_csv()
',a\n0,"This is a string with ""double quotes"""\n1,This is a string with \'single quotes\'\n'
However, when we look at the data in CARTO, double quotes have disappeared (single quotes remain correctly):
print(Dataset('testing_quotes').download()['a'])
cartodb_id
1 This is a string with double quotes
2 This is a string with 'single quotes'
Name: a, dtype: object
This happens even when escaping the double quotes, either with backslashes (\)...
df=pd.DataFrame({
'a': [
'This is a string with \"escaped double quotes\"',
"This is a string with 'single quotes'"
]
})
Dataset(df).upload(table_name='testing_quotes', if_exists='replace')
print(Dataset('testing_quotes').download()['a'])
cartodb_id
1 This is a string with escaped double quotes
2 This is a string with 'single quotes'
Name: a, dtype: object
...or further doubling up the double quotes:
df=pd.DataFrame({
'a': [
'This is a string with ""escaped double quotes""',
"This is a string with 'single quotes'"
]
})
Dataset(df).upload(table_name='testing_quotes', if_exists='replace')
print(Dataset('testing_quotes').download()['a'])
cartodb_id
1 This is a string with escaped double quotes
2 This is a string with 'single quotes'
Name: a, dtype: object
The text was updated successfully, but these errors were encountered:
Added by @arredond
When uploading data to CARTO via CartoFrames'
Dataset.upload()
method, double quotes are removed. Single quotes are not. This is probably somewhat related to https://github.com/CartoDB/support/issues/2219.An example can be seen here:
When looking at the original Pandas' DataFrame, double quotes are correctly managed:
If we use the DataFrame's internal
.to_csv()
method, double quotes are correctly escaped by doubling them up:However, when we look at the data in CARTO, double quotes have disappeared (single quotes remain correctly):
This happens even when escaping the double quotes, either with backslashes (
\
)......or further doubling up the double quotes:
The text was updated successfully, but these errors were encountered: