Python Forum

Full Version: Write in a csv file
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello,
I receive a data stream i want to record in a variable (array, list or dictionnary) and then write these data in a csv file.
My streamed data are coordinates of multiple marker. Hence at each loop i receive a data frame (marker1:x,y,z; marker 2:x,y,y ect..), so for exemple with 4 markers i receive 12 streamed data at each loop.
I would like to write these data in a csv file like this (data separated with tabulation):

marker 1.... marker 2....marker3 ect...
x y z......x y z......x y z
1 2 3......5 5 6......4 9 8
4 5 6......7 2 4......4 6 5

It seems simple but i really don't know what/how i can use array, list or dictionnary to do that.
Any help please?
Thanks
you can do it directly in pandas, see:
https://pandas.pydata.org/pandas-docs/st...o_csv.html