#C12772. DataFrame Creation and Plotting Challenge

    ID: 42236 Type: Default 1000ms 256MiB

DataFrame Creation and Plotting Challenge

DataFrame Creation and Plotting Challenge

In this challenge, you are required to create a DataFrame with 15 entries using the specified libraries. The DataFrame must have two columns: Time and Distance.

The Time column should store 15 equally spaced values ranging from 0 to 7 (interpreted as hours). The Distance column should store 15 random floating‐point numbers between 0 and 50. For consistency, use a fixed seed value (seed = 0) to generate the random numbers. Additionally, you must produce a line plot of Distance versus Time. The line plot should have the following customizations:

  • Line color: blue
  • Line style: dashed
  • Gridlines enabled
  • X-axis label: "Time (hours)"
  • Y-axis label: "Distance (km)"

After generating the plot (which you may display or simulate in your solution), output the DataFrame in CSV format to stdout with floating-point numbers formatted to 5 decimal places. The CSV should include a header row.

Note: Although the plotting functionality is required by the problem description, the final output that is checked will be the CSV representation of the DataFrame. There is no input required from stdin.

inputFormat

This problem does not require any input from stdin. Simply run the program.

outputFormat

The program should output the DataFrame in CSV format to stdout. The CSV must include a header and 15 data rows. Each floating-point number must be shown with 5 decimal places. The expected output format is exactly as shown in the sample output.

## sample
Time,Distance

0.00000,27.44068 0.50000,35.75947 1.00000,30.13817 1.50000,27.24416 2.00000,21.18274 2.50000,32.29471 3.00000,21.87936 3.50000,44.58865 4.00000,48.18314 4.50000,19.17208 5.00000,39.58625 5.50000,26.44475 6.00000,28.40223 6.50000,46.27983 7.00000,3.55180

</p>