Python Forum
import/use data from text files
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
import/use data from text files
#2
One way would be to do all the work yourself:
1. read a line (from the csv file or the json object)
2. strip the new line '\n' (if reading from text file)
3. split at the separator ',' (if reading from text file
4. convert to float using float()

steps 2 and 3 can be done for you if using the csv module (part of the Standard Python library)

all of the above could be done also using external packages as pandas/numpy. Given that you plan to plot the data - maybe this is the way to go.
Reply


Messages In This Thread
RE: import/use data from text files - by buran - Jun-28-2017, 08:51 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Import multiple CSV files into pandas Krayna 0 1,694 May-20-2021, 04:56 PM
Last Post: Krayna
  import columns of data from local csv file CatherineKan 2 3,301 May-10-2021, 05:10 AM
Last Post: ricslato
  Most Compatible Text Editor to Handle Large Files? Robotguy 2 2,336 Aug-18-2020, 03:51 PM
Last Post: FortyTwo
  Binning data to files Kappel 4 2,368 Jun-22-2020, 06:25 PM
Last Post: Kappel
  Unable to import data from Stata-press website Salahaddin 1 2,213 Jun-08-2020, 04:23 AM
Last Post: buran
  Can python read Marathi text files and summarize them? mcp111 0 1,784 Mar-18-2020, 08:58 AM
Last Post: mcp111
  Ask for machine learning Python example with 2 data files user5566b 2 2,232 Sep-05-2019, 12:15 PM
Last Post: user5566b
  Need Help With Filtering Data For Excel Files Using Pandas eddywinch82 9 5,988 Aug-06-2019, 03:44 PM
Last Post: eddywinch82
  import numpy in sub-files paul18fr 1 1,986 Aug-06-2019, 12:38 PM
Last Post: chakrimakam
  Text files vretenica 5 2,951 Jul-03-2019, 03:24 PM
Last Post: perfringo

Forum Jump:

User Panel Messages

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