2
$\begingroup$

I started with:

data = Import["https://www.destatis.de/DE/ZahlenFakten/GesellschaftStaat/Gesundheit/Todesursachen/Tabellen/Sterbefaelle_Unfaelle.html", "Data"]

Then extracted the data I needed with:

alter01b = data[[3,3, 4, 1, 2]]
alter02b = data[[3,3, 4, 2, 2]]
alter03b = data[[3,3, 4, 3, 2]]
alter04b = data[[3,3, 4, 4, 2]]
alter05b = data[[3,3, 4, 5, 2]]
alter06b = data[[3,3, 4, 6, 2]]
alter07b = data[[3,3, 4, 7, 2]]
alter08b = data[[3,3, 4, 8, 2]]
alter09b = data[[3,3, 4, 9, 2]]
alter10b = data[[3,3, 4, 10, 2]]
alter11b = data[[3,3, 4, 11, 2]]

And it gave me this:

21
67
86
706
800
800
1 394
1 787
2 436
6 727
9 738

The numbers with a whitespace (1 394 and onwards) are not regarded as such even when I remove the whitespace.

Can anyone help?

$\endgroup$
1
  • $\begingroup$ Please try If[StringQ[#], FromDigits[StringDelete[#, WhitespaceCharacter]], #] & /@ data[[3, 3, 4, All, 2]]. $\endgroup$ Mar 8, 2019 at 9:30

1 Answer 1

3
$\begingroup$
ReplaceAll[
 data[[3, 3, 4, All, 2]],
 s_String :> FromDigits[StringDelete[s, " "]]
]

{21, 67, 86, 706, 800, 800, 1394, 1787, 2436, 6727, 9783}

The ReplaceAll can of course also be represented as data[[3, 3, 4, All, 2]] /. s_String :> FromDigits[StringDelete[s, " "]], if preferred.

$\endgroup$
2
  • $\begingroup$ It´s working! Thanks a lot. Started with Wolfram Language only a couple of days ago... $\endgroup$
    – user63323
    Mar 8, 2019 at 20:10
  • $\begingroup$ @user63323 Glad to help! $\endgroup$
    – MarcoB
    Mar 8, 2019 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.