Python: parse multiple tables into one csv [on hold]
i have a csv file where all tables are underneath each other.
All tables have a MasterId with which I could link them.
Currently I try it with pandas.pivot_table
Here how the csv looks like now
masterId featureName featureValue
1 bar fooo
2 bar x
3 bar y
4 bar z
masterId featureName featureValue
1 zzz m
2 zzz p
3 zzz q
4 zzz r
.
.
.
How i want it to look like
masterId bar zzz
1 foo m
2 x p
3 y q
4 z r
Here my code to traspose
transposedTables = pd.pivot_table(
untransposedDataFrame,
index=["masterId"],
columns=["featureName"],
values=["featureValue"],
aggfunc=[np.sum],
dropna=True)
transposedTables.to_csv('./transposed_export_07012019.csv')
But some values remain empty although there is an entry for it
Do you have an idea why the fields are empty?
It has about Tables with each 10k lines and 19mb
i would be happy about hints
python-3.x pandas
New contributor
put on hold as off-topic by πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
add a comment |
i have a csv file where all tables are underneath each other.
All tables have a MasterId with which I could link them.
Currently I try it with pandas.pivot_table
Here how the csv looks like now
masterId featureName featureValue
1 bar fooo
2 bar x
3 bar y
4 bar z
masterId featureName featureValue
1 zzz m
2 zzz p
3 zzz q
4 zzz r
.
.
.
How i want it to look like
masterId bar zzz
1 foo m
2 x p
3 y q
4 z r
Here my code to traspose
transposedTables = pd.pivot_table(
untransposedDataFrame,
index=["masterId"],
columns=["featureName"],
values=["featureValue"],
aggfunc=[np.sum],
dropna=True)
transposedTables.to_csv('./transposed_export_07012019.csv')
But some values remain empty although there is an entry for it
Do you have an idea why the fields are empty?
It has about Tables with each 10k lines and 19mb
i would be happy about hints
python-3.x pandas
New contributor
put on hold as off-topic by πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
1
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago
add a comment |
i have a csv file where all tables are underneath each other.
All tables have a MasterId with which I could link them.
Currently I try it with pandas.pivot_table
Here how the csv looks like now
masterId featureName featureValue
1 bar fooo
2 bar x
3 bar y
4 bar z
masterId featureName featureValue
1 zzz m
2 zzz p
3 zzz q
4 zzz r
.
.
.
How i want it to look like
masterId bar zzz
1 foo m
2 x p
3 y q
4 z r
Here my code to traspose
transposedTables = pd.pivot_table(
untransposedDataFrame,
index=["masterId"],
columns=["featureName"],
values=["featureValue"],
aggfunc=[np.sum],
dropna=True)
transposedTables.to_csv('./transposed_export_07012019.csv')
But some values remain empty although there is an entry for it
Do you have an idea why the fields are empty?
It has about Tables with each 10k lines and 19mb
i would be happy about hints
python-3.x pandas
New contributor
i have a csv file where all tables are underneath each other.
All tables have a MasterId with which I could link them.
Currently I try it with pandas.pivot_table
Here how the csv looks like now
masterId featureName featureValue
1 bar fooo
2 bar x
3 bar y
4 bar z
masterId featureName featureValue
1 zzz m
2 zzz p
3 zzz q
4 zzz r
.
.
.
How i want it to look like
masterId bar zzz
1 foo m
2 x p
3 y q
4 z r
Here my code to traspose
transposedTables = pd.pivot_table(
untransposedDataFrame,
index=["masterId"],
columns=["featureName"],
values=["featureValue"],
aggfunc=[np.sum],
dropna=True)
transposedTables.to_csv('./transposed_export_07012019.csv')
But some values remain empty although there is an entry for it
Do you have an idea why the fields are empty?
It has about Tables with each 10k lines and 19mb
i would be happy about hints
python-3.x pandas
python-3.x pandas
New contributor
New contributor
New contributor
asked 2 days ago
s3niots3niot
1
1
New contributor
New contributor
put on hold as off-topic by πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
put on hold as off-topic by πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ 2 days ago
This question appears to be off-topic. The users who voted to close gave this specific reason:
- "Code not implemented or not working as intended: Code Review is a community where programmers peer-review your working code to address issues such as security, maintainability, performance, and scalability. We require that the code be working correctly, to the best of the author's knowledge, before proceeding with a review." – πάντα ῥεῖ, 200_success, Graipher, Hosch250, Sᴀᴍ Onᴇᴌᴀ
If this question can be reworded to fit the rules in the help center, please edit the question.
1
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago
add a comment |
1
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago
1
1
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago
add a comment |
0
active
oldest
votes
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
1
Welcome to Code Review! I'm afraid your question is not right for our site. We only review working code here. You can see our help center for more details about what is on-topic. You may be able to receive better help on Stack Overflow, but be sure to read their help pages and search around for similar questions before asking.
– Graham
2 days ago