Python Forum
How to store columns of a .csv in variables (when the .csv has no headers) ?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to store columns of a .csv in variables (when the .csv has no headers) ?
#1
Hello! I have a .csv file and by using the following code:

my_dataset = pandas_package.read_csv("MyMeasurements.csv")
my_dataset["date"] = pandas_package.to_datetime(my_dataset["DATE"])

TimeStamp = my_dataset["date"]
sensor1_measurements = my_dataset["sensor1"]
sensor2_measurements = my_dataset["sensor2"]
And I get correctly each column of the .csv assigned to each variable. The problem is the following:

How can I get the same result if the .csv does not have headers ('TimeStamp ', 'sensor1_measurements ', 'sensor2_measurements ')?

I tried google searching and testing code but nothing worked... Any ideas???
Reply


Messages In This Thread
How to store columns of a .csv in variables (when the .csv has no headers) ? - by hobbyist - Aug-17-2023, 08:52 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  TreeView column headers TWB 2 8,155 Jan-29-2023, 02:13 PM
Last Post: TWB
  export sql table to csv using BCP with headers mg24 0 1,228 Jan-19-2023, 05:36 AM
Last Post: mg24
  Code changing rder of headers Led_Zeppelin 0 1,472 Jul-13-2022, 05:38 PM
Last Post: Led_Zeppelin
  making variables in my columns and rows in python kronhamilton 2 2,391 Oct-31-2021, 10:38 AM
Last Post: snippsat
  Request Headers (scheme) JohnnyCoffee 0 2,419 Mar-31-2021, 09:17 PM
Last Post: JohnnyCoffee
  Reading csv with multiple "headers" Clives 3 3,613 Dec-31-2020, 09:25 AM
Last Post: Ana_junior
  module to store functions/variables and how to call them? mstichler 3 3,455 Jun-03-2020, 06:49 PM
Last Post: mstichler
  I can't use file __init__ to store shared variables and classes in the package AlekseyPython 2 4,172 Feb-04-2019, 06:26 AM
Last Post: AlekseyPython
  Receive Serial Data and store in different Variables in Python jenkins43 5 7,362 Dec-28-2018, 01:33 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

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