Writing nested lists into CSV











up vote
-2
down vote

favorite












I am new to Python and I have problem dealing with this. I have been using Orange3 Data Mining Tool to monitor some data and I wanted to make the workflow as automatic as possible in a real-time pace. I want to put my data into a csv file using Python script as shown below.



import csv
import Orange
myData = in_data

myFile = open('myFolder/MyFile.csv', 'w') with myFile:
writer = csv.writer(myFile)
writer.writerow(["Weight", "Word"])
writer.writerows(myData)


Note the data I am dealing with is the output of Cloud of Words in this list format:



[[65.000] {java},
[51.000] {web},
[43.000] {technologies},
..]


My problem is that the CSV file comes in this format:



screenshot of result



I can't really understand what is happening with all of that.










share|improve this question
























  • Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
    – mad_
    Nov 7 at 18:10












  • That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
    – Khaled Ouertani
    Nov 7 at 18:11






  • 1




    As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
    – martineau
    Nov 7 at 18:42










  • P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
    – martineau
    Nov 7 at 18:57

















up vote
-2
down vote

favorite












I am new to Python and I have problem dealing with this. I have been using Orange3 Data Mining Tool to monitor some data and I wanted to make the workflow as automatic as possible in a real-time pace. I want to put my data into a csv file using Python script as shown below.



import csv
import Orange
myData = in_data

myFile = open('myFolder/MyFile.csv', 'w') with myFile:
writer = csv.writer(myFile)
writer.writerow(["Weight", "Word"])
writer.writerows(myData)


Note the data I am dealing with is the output of Cloud of Words in this list format:



[[65.000] {java},
[51.000] {web},
[43.000] {technologies},
..]


My problem is that the CSV file comes in this format:



screenshot of result



I can't really understand what is happening with all of that.










share|improve this question
























  • Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
    – mad_
    Nov 7 at 18:10












  • That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
    – Khaled Ouertani
    Nov 7 at 18:11






  • 1




    As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
    – martineau
    Nov 7 at 18:42










  • P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
    – martineau
    Nov 7 at 18:57















up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











I am new to Python and I have problem dealing with this. I have been using Orange3 Data Mining Tool to monitor some data and I wanted to make the workflow as automatic as possible in a real-time pace. I want to put my data into a csv file using Python script as shown below.



import csv
import Orange
myData = in_data

myFile = open('myFolder/MyFile.csv', 'w') with myFile:
writer = csv.writer(myFile)
writer.writerow(["Weight", "Word"])
writer.writerows(myData)


Note the data I am dealing with is the output of Cloud of Words in this list format:



[[65.000] {java},
[51.000] {web},
[43.000] {technologies},
..]


My problem is that the CSV file comes in this format:



screenshot of result



I can't really understand what is happening with all of that.










share|improve this question















I am new to Python and I have problem dealing with this. I have been using Orange3 Data Mining Tool to monitor some data and I wanted to make the workflow as automatic as possible in a real-time pace. I want to put my data into a csv file using Python script as shown below.



import csv
import Orange
myData = in_data

myFile = open('myFolder/MyFile.csv', 'w') with myFile:
writer = csv.writer(myFile)
writer.writerow(["Weight", "Word"])
writer.writerows(myData)


Note the data I am dealing with is the output of Cloud of Words in this list format:



[[65.000] {java},
[51.000] {web},
[43.000] {technologies},
..]


My problem is that the CSV file comes in this format:



screenshot of result



I can't really understand what is happening with all of that.







python python-3.x csv orange






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 7 at 18:29









martineau

64.7k887172




64.7k887172










asked Nov 7 at 18:04









Khaled Ouertani

12311




12311












  • Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
    – mad_
    Nov 7 at 18:10












  • That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
    – Khaled Ouertani
    Nov 7 at 18:11






  • 1




    As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
    – martineau
    Nov 7 at 18:42










  • P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
    – martineau
    Nov 7 at 18:57




















  • Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
    – mad_
    Nov 7 at 18:10












  • That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
    – Khaled Ouertani
    Nov 7 at 18:11






  • 1




    As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
    – martineau
    Nov 7 at 18:42










  • P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
    – martineau
    Nov 7 at 18:57


















Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
– mad_
Nov 7 at 18:10






Do not post images. You will get better and quick responses. The format of data is not reproducible as it is not a valid list and will throw syntax error. print the output of print(myData[:5])
– mad_
Nov 7 at 18:10














That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
– Khaled Ouertani
Nov 7 at 18:11




That's actually why I asked this question the list's format looked strange for me I will update the question as you asked.
– Khaled Ouertani
Nov 7 at 18:11




1




1




As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
– martineau
Nov 7 at 18:42




As @mad_ said, the format of the output of Cloud of Words shown is not in the format of a valid Python list. Try posting the output you get from a print(repr(myData) statement in your question.
– martineau
Nov 7 at 18:42












P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
– martineau
Nov 7 at 18:57






P.S. You might to do a myData = in_data.tolist() first (before the print(repr(myData)).
– martineau
Nov 7 at 18:57



















active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195235%2fwriting-nested-lists-into-csv%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53195235%2fwriting-nested-lists-into-csv%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Xamarin.form Move up view when keyboard appear

Post-Redirect-Get with Spring WebFlux and Thymeleaf

Anylogic : not able to use stopDelay()