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:
I can't really understand what is happening with all of that.
python python-3.x csv orange
add a comment |
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:
I can't really understand what is happening with all of that.
python python-3.x csv orange
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 ofprint(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 aprint(repr(myData)
statement in your question.
– martineau
Nov 7 at 18:42
P.S. You might to do amyData = in_data.tolist()
first (before theprint(repr(myData)
).
– martineau
Nov 7 at 18:57
add a comment |
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:
I can't really understand what is happening with all of that.
python python-3.x csv orange
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:
I can't really understand what is happening with all of that.
python python-3.x csv orange
python python-3.x csv orange
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 ofprint(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 aprint(repr(myData)
statement in your question.
– martineau
Nov 7 at 18:42
P.S. You might to do amyData = in_data.tolist()
first (before theprint(repr(myData)
).
– martineau
Nov 7 at 18:57
add a comment |
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 ofprint(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 aprint(repr(myData)
statement in your question.
– martineau
Nov 7 at 18:42
P.S. You might to do amyData = in_data.tolist()
first (before theprint(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
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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
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 theprint(repr(myData)
).– martineau
Nov 7 at 18:57