Python Forum
deleting columns in CSV file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
deleting columns in CSV file
#8
(Nov-26-2022, 05:23 PM)astral_travel Wrote: although i got the wanted result, it produced the file i want with only one of the columns (the Ticker column), but why in the IDE it gives me this error ?
The loop make litte sense,this dos the same
df['Ticker'].to_csv('/home/tal/investing/Ticker.csv', index=False)
The varibale columnSeriesObj is created 3 times in the,where only the last one is used.
The columnSeriesObj.values just print the same values 3 times.

In Pandas so is using loops in many/most cases the wrong soution as should use a vectorized solution(that's build-in and there are many)
So Pandas is a diffrent way to program than the standar Python way,you are new to both so it's can be confusing.

Can look 30 Methods You Should Master To Become A Pandas Pro
See that not once is a for loop used.
Reply


Messages In This Thread
deleting columns in CSV file - by astral_travel - Nov-25-2022, 09:53 PM
RE: deleting columns in CSV file - by snippsat - Nov-25-2022, 10:37 PM
RE: deleting columns in CSV file - by astral_travel - Nov-26-2022, 12:31 PM
RE: deleting columns in CSV file - by deanhystad - Nov-26-2022, 01:33 PM
RE: deleting columns in CSV file - by astral_travel - Nov-26-2022, 02:26 PM
RE: deleting columns in CSV file - by snippsat - Nov-26-2022, 02:35 PM
RE: deleting columns in CSV file - by astral_travel - Nov-26-2022, 05:23 PM
RE: deleting columns in CSV file - by snippsat - Nov-26-2022, 07:14 PM
RE: deleting columns in CSV file - by astral_travel - Nov-26-2022, 09:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Create Choices from .ods file columns cspower 3 757 Dec-28-2023, 09:59 PM
Last Post: deanhystad
  Create csv file with 4 columns for process mining thomaskissas33 3 877 Nov-06-2023, 09:36 PM
Last Post: deanhystad
  Converting a json file to a dataframe with rows and columns eyavuz21 13 5,136 Jan-29-2023, 03:59 PM
Last Post: eyavuz21
  Replace columns indexes reading a XSLX file Larry1888 2 1,064 Nov-18-2022, 10:16 PM
Last Post: Pedroski55
  rows from sql query need to write to a file as columns sjcsvatt 6 2,553 Oct-09-2021, 12:45 AM
Last Post: snippsat
  [Solved] Using readlines to read data file and sum columns Laplace12 4 3,729 Jun-16-2021, 12:46 PM
Last Post: Laplace12
  Python Matplotlib: Create chart for every 4 columns in Excel file JaneTan 2 2,860 Feb-28-2021, 05:02 AM
Last Post: JaneTan
  How to fill parameter with data from multiple columns CSV file greenpine 1 1,730 Dec-21-2020, 06:50 PM
Last Post: Larz60+
  Read strings and numbers in columns from a file suvadip 4 3,049 Aug-11-2020, 09:37 PM
Last Post: suvadip
  Rearrange Columns in a CSV File rjj920 1 5,703 May-09-2020, 03:26 PM
Last Post: DPaul

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020