Python Forum
convert string to float in list
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
convert string to float in list
#7
ok Thanks all,
I solve it by adding this
import pandas as pd

#uplink
df1 = pd.DataFrame(UL)
df1 = df1.rename(columns=df1.iloc[0]).drop(df1.index[0])

df1['ingress-traffic'] = df1['ingress-traffic'].astype(float)
df1['egress-traffic'] = df1['egress-traffic'].astype(float)
Reply


Messages In This Thread
convert string to float in list - by jacklee26 - Feb-10-2023, 10:43 AM
RE: convert string to float in list - by noisefloor - Feb-10-2023, 11:41 AM
RE: convert string to float in list - by snippsat - Feb-10-2023, 03:41 PM
RE: convert string to float in list - by jacklee26 - Feb-11-2023, 01:48 AM
RE: convert string to float in list - by noisefloor - Feb-11-2023, 05:06 PM
RE: convert string to float in list - by snippsat - Feb-11-2023, 06:27 PM
RE: convert string to float in list - by jacklee26 - Feb-13-2023, 01:14 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python calculate float plus float is incorrect? sirocawa 6 400 Apr-16-2024, 01:45 PM
Last Post: DeaD_EyE
  convert a list to links Pir8Radio 3 1,151 Nov-28-2022, 01:52 PM
Last Post: Pir8Radio
  openpyxl convert data to float jacklee26 13 6,223 Nov-19-2022, 11:59 AM
Last Post: deanhystad
  convert this List Comprehensions to loop jacklee26 8 1,563 Oct-21-2022, 04:25 PM
Last Post: deanhystad
  how to convert tuple value into string mg24 2 2,425 Oct-06-2022, 08:13 AM
Last Post: DeaD_EyE
  Convert SQLite Fetchone() Result to float for Math Extra 13 3,657 Aug-02-2022, 01:12 PM
Last Post: deanhystad
  TypeError: float() argument must be a string or a number, not 'list' Anldra12 2 4,951 Jul-01-2022, 01:23 PM
Last Post: deanhystad
  Convert string to float problem vasik006 8 3,485 Jun-03-2022, 06:41 PM
Last Post: deanhystad
  Detecting float or int in a string Clunk_Head 15 4,732 May-26-2022, 11:39 PM
Last Post: Pedroski55
  Convert a string to a function mikepy 8 2,614 May-13-2022, 07:28 PM
Last Post: mikepy

Forum Jump:

User Panel Messages

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