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,600 points
482 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,000 points

Related Questions In Others

0 votes
0 answers

Creating an Instagram bot with reading an excel file and posing on Instagram, but some of words can not be read properly

from instabot import Bot import openpyxl import smtplib bot = ...READ MORE

Sep 26, 2022 in Others by Kithuzzz
• 38,000 points
824 views
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,600 points
1,981 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
7,937 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,690 points
14,039 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 4,454 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,000 points
389 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,000 points
12,207 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