solution6.tex 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. \documentclass[a4paper,11pt,openright]{report}
  2. \setlength{\parindent}{0pt} % set noindent for entire file
  3. \usepackage[utf8]{inputenc}
  4. \usepackage[a4paper, left=20mm, right=20mm, top=20mm]{geometry}
  5. \usepackage{xcolor,graphicx}
  6. \usepackage{amsmath}
  7. \usepackage{setspace}
  8. \usepackage{sectsty}
  9. \usepackage{etoolbox}
  10. \usepackage{enumitem}
  11. \usepackage{listings}
  12. \usepackage{times}
  13. \graphicspath{ {/home/saran/Analytics/Apr_27/} }
  14. \lstdefinestyle{mystyle}{
  15. backgroundcolor=\color{white},
  16. basicstyle=\ttfamily\footnotesize,
  17. breakatwhitespace=false,
  18. breaklines=true,
  19. captionpos=b,
  20. keepspaces=true,
  21. showspaces=false,
  22. showstringspaces=false,
  23. showtabs=false,
  24. tabsize=4
  25. }
  26. \lstset{style=mystyle}
  27. \begin{document}
  28. \singlespacing
  29. \pagestyle{plain}
  30. \begin{center}
  31. \textbf{Answers to Question Set 6} \\
  32. Date: 27/04/2020 \hspace{2mm} Name: D.Saravanan
  33. \end{center}
  34. \vspace{10px}
  35. \textbf{Question 1:} \\
  36. Write a python program to generate 9 random integers in numpy. Convert it to a 3$\times$3 matrix
  37. and then convert it to a dataframe. \\
  38. Program:
  39. \lstinputlisting[language=Python]{question1.py}
  40. \vspace{5px}
  41. Output:
  42. \lstinputlisting{output1.txt}
  43. \vspace{10px}
  44. \textbf{Question 2:} \\
  45. Write a python program to generate a dataframe with the random values in column and
  46. calculate the mean and the standard deviation. \\
  47. Program:
  48. \lstinputlisting[language=Python]{question2.py}
  49. \vspace{5px}
  50. \pagebreak
  51. Output:
  52. \lstinputlisting{output2.txt}
  53. \vspace{10px}
  54. \textbf{Question 3:} \\
  55. Write a python program to plot the mean and the standard deviation from the dataframe of
  56. previous question using pandas inbuilt plot function and save the dataframe as JSON file
  57. format.\\
  58. Program:
  59. \lstinputlisting[language=Python]{question3.py}
  60. \vspace{10px}
  61. Output:
  62. %figure_1
  63. \begin{figure}[ht!]
  64. \includegraphics[width=18cm,height=9cm,keepaspectratio]{dframe.pdf}
  65. \end{figure}
  66. \end{document}