Jun-20-2019, 03:52 PM
Hi
Obviously did this wrong.
Situation:
CSV text file importing into pandas
Problem, the source has numbers with ., rather than ,. so its been imported as text.
Applied a replace (for . to nothing) and a second replace (comma to dot) so now looks like a number.
Used the .astype to try to push to float.
- c is from a list (at the moment only one column but may have more in the future)
- df is the dataframe
- bfc is the variable of the class
Coding is in a class (trying something out)
The column that is meant to be a number is not returning.
Any pointers as to what I can look at to solve this or a different route to import... welcomed
Obviously did this wrong.
Situation:
CSV text file importing into pandas
Problem, the source has numbers with ., rather than ,. so its been imported as text.
Applied a replace (for . to nothing) and a second replace (comma to dot) so now looks like a number.
Used the .astype to try to push to float.
df.update(df[c].str.replace('.','').str.replace(',','.').astype(float))variables
- c is from a list (at the moment only one column but may have more in the future)
- df is the dataframe
- bfc is the variable of the class
Coding is in a class (trying something out)
bfc.dfDemands.groupby(by='source').sum()only returns the source column and a column set to False.
The column that is meant to be a number is not returning.
Any pointers as to what I can look at to solve this or a different route to import... welcomed