I have an API call that is returning tab-separated data using python. I can export and then load using pd.read_csv("FileName.txt", sep="\t")
however I was looking to take the data from the call and then load it straight into a Dataframe (without having to save it and use read_csv). Is there a way to do this?
Asked
Active
Viewed 28 times
0

some_programmer
- 3,268
- 4
- 24
- 59

Sloth87
- 435
- 5
- 8
-
2what is the type of data you return? you can wrap a `StringIO` and read the StringIO object with read_csv. Or there might be a better way depending on how your data gets returned. look at this: [Create Pandas DataFrame from a string](https://stackoverflow.com/questions/22604564/create-pandas-dataframe-from-a-string) – anky Feb 02 '21 at 15:47
-
StringIO worked perfectly thank you – Sloth87 Feb 02 '21 at 16:05
-
thanks for confirming, closing the question since this has been asked before. – anky Feb 02 '21 at 16:06