excel not reading some data

0 votes

I used Python to build a CSV file containing 150 columns, each of which should have the values 0, 1, or 2. I open Excel, enter data, obtain the data from text, select the comma as the delimiter, etc. The issue is that only the first column has been appropriately filled with the desired data; the remaining 149 columns are all empty. Yet, it seems nice and each column is filled appropriately when I load that file in PyCharm, where I typed the code.

I saved the data using

allData.to_csv('allData.csv', index=False)
Apr 10, 2023 in Others by narikkadan
• 63,420 points
193 views

1 answer to this question.

0 votes

When using the sep option in the to csv method to save the CSV file, you can consider explicitly specifying the delimiter to a comma. Here is a sample of the code:

import pandas as pd
# Create a sample DataFrame with 150 columns containing 0, 1, or 2
data = pd.DataFrame({'col_' + str(i): [0, 1, 2] for i in range(150)})
# Save the data to a CSV file with comma as delimiter
data.to_csv('allData.csv', index=False, sep=',')
answered Apr 10, 2023 by Kithuzzz
• 38,010 points

Related Questions In Others

0 votes
1 answer
0 votes
1 answer

Excel Consolidate Data not working - Data does not merge

This is so that letters cannot be ...READ MORE

answered Nov 17, 2022 in Others by narikkadan
• 63,420 points
1,315 views
0 votes
1 answer

How to import data from a HTML table on a website to excel?

Hello  To import any HTML file in excel there ...READ MORE

answered Feb 10, 2022 in Others by gaurav
• 23,260 points
5,926 views
0 votes
1 answer

How to convert data from txt files to Excel files using python

Hi , there are few steps to ...READ MORE

answered Feb 16, 2022 in Others by Edureka
• 13,670 points
13,114 views
0 votes
2 answers
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 7, 2019 in Python by Neha
• 330 points

edited Jul 8, 2019 by Kalgi 3,976 views
0 votes
1 answer
0 votes
1 answer

Ordering data in python or excel

Basically, the data is converted from wide ...READ MORE

answered Feb 11, 2023 in Others by Kithuzzz
• 38,010 points
167 views
0 votes
1 answer

Excel number formatting thousands is not working

Follow these steps: 1- choose cells you want ...READ MORE

answered Feb 16, 2023 in Others by Kithuzzz
• 38,010 points
4,815 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP