Skip to content

Commit 38caf12

Browse files
tab to space
1 parent ad74668 commit 38caf12

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

wosis/analysis/stats.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
def calc_average_citations(in_df, max_year=None, sort=False):
44
"""Calculate the average citations since year of publication.
5-
6-
If no `max_year` is specified, calculate using the latest
7-
year in given dataset.
5+
6+
If no `max_year` is specified, calculate using the latest
7+
year in given dataset.
88
99
Example
1010
==========
@@ -18,7 +18,7 @@ def calc_average_citations(in_df, max_year=None, sort=False):
1818
Parameters
1919
==========
2020
* in_df : Pandas DataFrame
21-
* max_year: int or None, year to calculate average citations from.
21+
* max_year: int or None, year to calculate average citations from.
2222
2323
Returns
2424
==========
@@ -27,15 +27,15 @@ def calc_average_citations(in_df, max_year=None, sort=False):
2727
assert hasattr(in_df, 'citations'), \
2828
'DataFrame has to have `citation` column. Use `get_num_citations()` first'
2929
out_df = in_df.copy()
30-
31-
max_year_in_data = out_df.year.max()
32-
33-
if max_year not None:
34-
max_year = int(max_year)
35-
assert max_year_in_data <= max_year, \
36-
"Given max_year must be later than any year found in dataset."
30+
31+
max_year_in_data = out_df.year.max()
32+
33+
if max_year not None:
34+
max_year = int(max_year)
35+
assert max_year_in_data <= max_year, \
36+
"Given max_year must be later than any year found in dataset."
3737
else:
38-
max_year = out_df.year.max()
38+
max_year = out_df.year.max()
3939
out_df.loc[:, 'Avg. Citations'] = (out_df.citations / ((max_year - out_df.year) + 1)).astype(float).round(2)
4040

4141
if sort:

0 commit comments

Comments
 (0)