Python Forum
Frequency in first digit from csv file, NO IMPORT
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Frequency in first digit from csv file, NO IMPORT
#7
file = open("sample_accounts.csv", "r")
filecsv = file.read()
filecsv = filecsv.lower()
a = []
b = []
  
chlist = list(range(128))
del chlist[48:58]

csv_lst = filecsv.split(' ') 
fd_lst = []
for c in chlist:
    filecsv = filecsv.replace(chr(c),"")
for item in filecsv:
    fd_lst.append((item[0].strip())) 
# print('digit  frequency')
for x in set(fd_lst):
    a.append(item)
    print([x,fd_lst.count(x)])

I quoted please have a look
Reply


Messages In This Thread
RE: Frequency in first digit from csv file, NO IMPORT - by bryan0901 - May-28-2020, 09:50 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  list digit into number Voldyy 2 1,615 Jul-10-2022, 06:13 PM
Last Post: deanhystad
  Import Python file with a name of a module in Stantard Library tiago_code 7 3,260 Dec-11-2019, 06:08 AM
Last Post: ICanIBB
  Four-digit number text translation. soz 3 2,755 May-13-2019, 03:02 PM
Last Post: buran
  create three digit numbers Krszt 4 4,600 Dec-09-2018, 03:12 PM
Last Post: ThePhi
  Sum of digit in a string MEH012 1 9,571 Apr-20-2018, 02:13 AM
Last Post: Larz60+
  Import a Data from a text file maxcom 1 2,469 Apr-01-2018, 07:30 PM
Last Post: Larz60+
  Allow only digit penoxcz 3 3,883 Nov-14-2017, 03:04 PM
Last Post: wavic
  Four digit combinations EHod 4 7,892 Aug-13-2017, 09:14 PM
Last Post: EHod
  Import random from a txt file Liquid_Ocelot 4 7,611 May-05-2017, 10:14 PM
Last Post: Liquid_Ocelot

Forum Jump:

User Panel Messages

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