Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8362369
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T11:55:21+00:00 2026-06-09T11:55:21+00:00

I have a TSV file that consists of integers along with some false data

  • 0

I have a TSV file that consists of integers along with some false data that could be anything such as floats or characters etc.

The idea is to read the contents of the file and find out which ones are bad (containing data other than integers)

Each line can be read using the readline method once the file has been opened for reading. Off course, the readline() method returns each line read as a string and not it’s constituent data types. My understanding is, that I could use the pickle module somehow to ensure that i retain the original data type by representing it as it’s serialized version carrying out dump and load methods.

The question is, how do I do this?

By reading each line and pickling it, would not help since readline by default reads it as a string. Thereby upon pickling, it’s really just pickling a string into a serialized python object representation and unpickling would only return it as a string. Thus the actual data in the line, such as integers or chars are being represented as strings irrespective.

So I assume the question is, how do I pickle things the right way OR how do I process each line of a file ensuring that it’s data types are being maintained?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T11:55:22+00:00Added an answer on June 9, 2026 at 11:55 am

    As if you are getting the string from pickle,just split the string using ‘\t’ then use

    a = "0343523"
    a.isdigit()
    True
    
    b = "934sjsspam"
    b.isdigit()
    False
    

    There is one more method for unicodes also unicodes numeric check , so just use them

    and maintain the data types

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a TSV (tab-separated value) file that I need to spell-check for misspellings
I have a Perl script using a system call to sort a tsv file:
I have a column with a list of dates in a spreadsheet (.tsv) (some
We have recently compared the respective file sizes of the same tabular data (think
Have data that has this kind of structure. Will be in ascending order by
Say you have 32000 records with 89 bytes/record stored in a TSV file. You
I have a Tab Separated Value file that I need to import in mongodb
I have 3 tsv files containing different data on my employees. I can join
I have over 125 TSV files of ~100Mb each that I want to merge.
I have a multiline TSV file with the following format: Type\tBasic Name\tAttribute\tA Long Description\n

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.