Plot the following table Please

[{“metadata”:{“trusted”:true},“cell_type”:“code”,“source”:“using DataFrames;df = DataFrame(m)”,“execution_count”:14,“outputs”:[{“data”:{“text/html”:"

40 rows × 3 columns (omitted printing of 1 columns)

shoename shoeprice
String String
1 Dwane IDP Running Shoes For Men\xa0\xa0(Black) 1,599
2 Jio-13 Running Shoes For Men\xa0\xa0(Silver, Black) 474
3 DROGO M SS 19 Running Shoes For Men\xa0\xa0(Blue) 1,699
4 IMPULSE Running Shoes For Men\xa0\xa0(Blue) 1,039
5 SM-397 Running Shoes For Men\xa0\xa0(Red, Black) 840
6 LEGEND Walking Shoes For Men\xa0\xa0(Blue) 1,049
7 Marsh Cricket Shoes For Men\xa0\xa0(White, Blue) 890
8 Revolution 3 Running Shoes For Men\xa0\xa0(Grey) 2,401
9 Men SM-406 Black Running Shoes For Men\xa0\xa0(Black) 882
10 WNDR-13 Running Shoes For Men\xa0\xa0(Red, Black) 474
11 Running Shoes For Men\xa0\xa0(Navy) 474
12 HYPERON M SS 19 Walking Shoes For Men\xa0\xa0(Black) 1,649
13 19 FH Rubber Cricket Shoes For Men\xa0\xa0(Red, Black) 2,749
14 DROGO M SS 19 Running Shoes For Men\xa0\xa0(Blue, Orange) 1,699
15 WNDR-13 Running Shoes For Men\xa0\xa0(Black, Grey) 474
16 SM-406 Running Shoes For Men\xa0\xa0(Navy, Grey) 882
17 Dwane IDP Running Shoes For Men\xa0\xa0(Blue) 1,599
18 Running,Gym,Sports Walking Shoes For Men\xa0\xa0(Black) 399
19 Oxygen Running Shoes For Men\xa0\xa0(White, Navy) 459
20 SM-397 Running Shoes For Men\xa0\xa0(Blue, Black) 840
21 ROYCE Running Shoes For Men\xa0\xa0(Blue) 888
22 VERTIGO BLK RUNNING SHOES For MEN 10 Running Shoes For Men\xa0\xa0(Black) 999
23 Gel-Contend 4B Running Shoes For Men\xa0\xa0(Black) 1,924
24 Dwane IDP Running Shoes For Men\xa0\xa0(White) 1,599
25 SM-300 Running Shoes For Men\xa0\xa0(Navy, Green) 714
26 Jio-13 Running Shoes For Men\xa0\xa0(Green) 474
27 Running Shoes For Men\xa0\xa0(Navy) 474
28 Density Running Shoes For Men\xa0\xa0(Navy) 429
29 Running Shoes For Men\xa0\xa0(Black) 999
30 Athleisure Range Sports Walking Shoes For Men\xa0\xa0(Navy) 1,197

“,“text/latex”:”\begin{tabular}{r|ccc}\n\t& shoename & shoeprice & \\\n\t\hline\n\t& String & String & \\\n\t\hline\n\t1 & Dwane IDP Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 1,599 & \\dots \\\n\t2 & Jio-13 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Silver, Black) & 474 & \\dots \\\n\t3 & DROGO M SS 19 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue) & 1,699 & \\dots \\\n\t4 & IMPULSE Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue) & 1,039 & \\dots \\\n\t5 & SM-397 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Red, Black) & 840 & \\dots \\\n\t6 & LEGEND Walking Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue) & 1,049 & \\dots \\\n\t7 & Marsh Cricket Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(White, Blue) & 890 & \\dots \\\n\t8 & Revolution 3 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Grey) & 2,401 & \\dots \\\n\t9 & Men SM-406 Black Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 882 & \\dots \\\n\t10 & WNDR-13 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Red, Black) & 474 & \\dots \\\n\t11 & Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy) & 474 & \\dots \\\n\t12 & HYPERON M SS 19 Walking Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 1,649 & \\dots \\\n\t13 & 19 FH Rubber Cricket Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Red, Black) & 2,749 & \\dots \\\n\t14 & DROGO M SS 19 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue, Orange) & 1,699 & \\dots \\\n\t15 & WNDR-13 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black, Grey) & 474 & \\dots \\\n\t16 & SM-406 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy, Grey) & 882 & \\dots \\\n\t17 & Dwane IDP Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue) & 1,599 & \\dots \\\n\t18 & Running,Gym,Sports Walking Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 399 & \\dots \\\n\t19 & Oxygen Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(White, Navy) & 459 & \\dots \\\n\t20 & SM-397 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue, Black) & 840 & \\dots \\\n\t21 & ROYCE Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Blue) & 888 & \\dots \\\n\t22 & VERTIGO BLK RUNNING SHOES For MEN 10 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 999 & \\dots \\\n\t23 & Gel-Contend 4B Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 1,924 & \\dots \\\n\t24 & Dwane IDP Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(White) & 1,599 & \\dots \\\n\t25 & SM-300 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy, Green) & 714 & \\dots \\\n\t26 & Jio-13 Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Green) & 474 & \\dots \\\n\t27 & Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy) & 474 & \\dots \\\n\t28 & Density Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy) & 429 & \\dots \\\n\t29 & Running Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Black) & 999 & \\dots \\\n\t30 & Athleisure Range Sports Walking Shoes For Men\textbackslash{}xa0\textbackslash{}xa0(Navy) & 1,197 & \\dots \\\n\t$\dots$ & \\dots & \\dots & \\\n\end{tabular}\n",“text/plain”:"40×3 DataFrame. Omitted printing of 3 columns\n│ Row │ │ │ ├─────┼\n│ 1 │ │ 2 │ │ 3 │ │ 4 │ │ 5 │ │ 6 │ │ 7 │ │ 8 │ │ 9 │ │ 10 │ \n⋮\n│ 30 │ │ 31 │ │ 32 │ │ 33 │ │ 34 │ │ 35 │ │ 36 │ │ 37 │ │ 38 │ │ 39 │ │ 40 │ "},“execution_count”:14,“metadata”:{},“output_type”:“execute_result”}]}]

Please provide complete information about what you want to do.

3 Likes

I have got a CSV table in Julia. One of the column as ‘shoeprice’ is
shown as string. Because of this I am not able to plot it. I need
your help. I sent you the table already.

Here is an example to help you

julia> using DataFrames, Plots;

julia> df = DataFrame(shoetype = ["Sneaker", "Boot", "High-heels"], price = [10, 20, 15]);

julia> bar(df.shoetype, df.price);

It produces the following graph:

Screenshot from 2020-09-16 11-54-36

2 Likes

You can convert strings to numbers with the parse function like parse.(Int, shoeprice) where shoeprice is the shoeprice column in your table.

1 Like

I had not understood the problem that the numbers were written as strings.
But a straight parse won’t help, since they contain commas:

julia> parse(Int, "2,314")
ERROR: ArgumentError: invalid base 10 digit ',' in "2,314"

I have some hacky (not the worlds most performant) string parsing functions to strip out junk if that’d help, but for just stripping commas and spaces it’s easy though…

comma_strip(x::String) = parse(Int, filter(s -> (s != ',') && !isspace(s), x) )
comma_strip("2,3 0 9,")

Not sure what the OP wants though? I am confident they can learn to use Plots.jl

1 Like

Just looking at the table it seems parse.(Int, replace.(df.shoeprice, "," => "")) would do the trick?

2 Likes

Thanks for the suggestion. I need one more help. I have got the table
applying the following codes. Please help me to get a bar chart from
it.
using Pkg;Pkg.add(“StatsPlots”);using DataFrames;df=DataFrame(m)
df2 = df |> x → begin x[:shoeprice] =parse.(Int,
replace.(df.shoeprice, “,” => “”)) ; x end

40 rows × 3 columns (omitted printing of 1 columns)

shoename shoeprice
String Int64
1 Dwane IDP Running Shoes For Men\xa0\xa0(Black) 1599
2 Jio-13 Running Shoes For Men\xa0\xa0(Silver, Black) 474
3 DROGO M SS 19 Running Shoes For Men\xa0\xa0(Blue) 1699
4 IMPULSE Running Shoes For Men\xa0\xa0(Blue) 1039
5 SM-397 Running Shoes For Men\xa0\xa0(Red, Black) 840
6 LEGEND Walking Shoes For Men\xa0\xa0(Blue) 1049
7 Marsh Cricket Shoes For Men\xa0\xa0(White, Blue) 890
8 Revolution 3 Running Shoes For Men\xa0\xa0(Grey) 2401
9 Men SM-406 Black Running Shoes For Men\xa0\xa0(Black) 882
10 WNDR-13 Running Shoes For Men\xa0\xa0(Red, Black) 474
11 Running Shoes For Men\xa0\xa0(Navy) 474
12 HYPERON M SS 19 Walking Shoes For Men\xa0\xa0(Black) 1649
13 19 FH Rubber Cricket Shoes For Men\xa0\xa0(Red, Black) 2749
14 DROGO M SS 19 Running Shoes For Men\xa0\xa0(Blue, Orange) 1699
15 WNDR-13 Running Shoes For Men\xa0\xa0(Black, Grey) 474
16 SM-406 Running Shoes For Men\xa0\xa0(Navy, Grey) 882
17 Dwane IDP Running Shoes For Men\xa0\xa0(Blue) 1599
18 Running,Gym,Sports Walking Shoes For Men\xa0\xa0(Black) 399
19 Oxygen Running Shoes For Men\xa0\xa0(White, Navy) 459
20 SM-397 Running Shoes For Men\xa0\xa0(Blue, Black) 840
21 ROYCE Running Shoes For Men\xa0\xa0(Blue) 888
22 VERTIGO BLK RUNNING SHOES For MEN 10 Running Shoes For Men\xa0\xa0(Black) 999
23 Gel-Contend 4B Running Shoes For Men\xa0\xa0(Black) 1924
24 Dwane IDP Running Shoes For Men\xa0\xa0(White) 1599
25 SM-300 Running Shoes For Men\xa0\xa0(Navy, Green) 714
26 Jio-13 Running Shoes For Men\xa0\xa0(Green) 474
27 Running Shoes For Men\xa0\xa0(Navy) 474
28 Density Running Shoes For Men\xa0\xa0(Navy) 429
29 Running Shoes For Men\xa0\xa0(Black) 999
30 Athleisure Range Sports Walking Shoes For Men\xa0\xa0(Navy) 1197
⋮ ⋮

See my post above: Plot the following table Please - #4 by pdeffebach

2 Likes

Thank a lot for your suggestion. In my table there are 40 shoename and 40 shoeprice. Is there any other way to get all these instead of writing one by one? Looking forward to your kind suggestion.

I wrote out those shoes as an example. Your data is already in the correct format to make that graph.

1 Like

I edited the provided code to work with your variables.

using Plots
bar(df2.shoename, df2.shoeprice)

Thanks a lot. I will check and let you know.