#C13914. DataFrame Creation and Histogram Plotting
DataFrame Creation and Histogram Plotting
DataFrame Creation and Histogram Plotting
Given a random seed as input, generate a DataFrame with 3 columns: A
, B
, and C
. Each column should contain 15 integer values. The values are generated deterministically using the formula
\[
value = ((seed + i) \mod 100) + 1
\]
where i
is the index of the generated number (starting from 0) and seed
is the input integer. The DataFrame should then be printed to standard output in CSV format (with a header line).
Additionally, generate a histogram for column A
using 5 bins. The histogram should use the color skyblue
with black edges, have appropriate x and y labels, and a title. Save the histogram as a file named histogram.png
. In languages where plotting is not readily available, simulating the creation of an empty file named histogram.png
is acceptable.
inputFormat
The input consists of a single integer, representing the random seed, provided via standard input.
outputFormat
The output should be the CSV representation of the DataFrame. The first line is a header containing A,B,C
. The following 15 lines each contain the values for the corresponding row, with the values in the three columns separated by commas.
0
A,B,C
1,16,31
2,17,32
3,18,33
4,19,34
5,20,35
6,21,36
7,22,37
8,23,38
9,24,39
10,25,40
11,26,41
12,27,42
13,28,43
14,29,44
15,30,45
</p>