Skip to content

Conversation

@Us-manArshad
Copy link
Owner

Opening Pull request for weather data analysis.

find_max.py Outdated
@@ -0,0 +1,8 @@
# Function to find maximum value from the list
class Max:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a built-in max() method in python.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done sir

main.py Outdated
from read_csv_all import Find


class Main:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rename this class to something else. something like Weather because main is used for different purpose.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it sir

read_csv.py Outdated
@@ -0,0 +1,39 @@
from find_max import Max
class ReadFiles:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Pep-8 missing. There must be 2 blank lines before a class.
  2. Why do you have to make a separate class for all these helper methods. Move all these methods inside the Weather class in main.py

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sir you are right this is better approach.

read_csv_all.py Outdated
import os
from find_max import Max
from read_csv import ReadFiles
class Find:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Pep8 missing
  2. move these methods to the Weather class.

read_csv_all.py Outdated
if hottest_temp == Max.find(ReadFiles.read_files(file, filename)):
li.append(filename)

return print(f"The overall Hottest Temperature is:- {hottest_temp} at months:- {li}")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return must return some values not the print statement.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes sir I just fixed it

Copy link

@sadan sadan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the rest of the codes again and use more meaningful variable names.

main.py Outdated
data_list.append(int(data[1]))

# Find the maximum temp from Max TempC
found = self.search_max(data_list)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use python max() method to find the maximum value in a list.

https://docs.python.org/3.6/library/functions.html#max

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when using max() method it causes an an error "ValueError: max() arg is an empty sequence"
as in my csv data there are many months those are empty in temperature column.

main.py Outdated
high_temp.append(Max.find(ReadFiles.read_csv_files(file, filename)))
hottest_temp = Max.find(high_temp)
# Find the maximum temp from Max TempC
found = self.search_max(data_list)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rename this variable to be more meaningful with the data. Since you are storing maximum temperature, I would name it something like max_temp

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noted sir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants