rdatasets 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/rdatasets.rb +6 -2
- data/lib/rdatasets/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f389577db8c4aede4d03551b0a6788a0f1970c8b5d79da1f70e77876f9a74d28
|
4
|
+
data.tar.gz: b1801bf49f1a39cc3eb8b06e045d7a4a2643fcba624623c8901b18aa1535de40
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b75eb647f720b21312f4d55d215d988678641d967f64b27362fcb086d1ea59d7780b3a041fc5417c71eb5dce548c2360afa5fd52197a4314a45102dc6f3b860b
|
7
|
+
data.tar.gz: aa748bdc70807c89a18b8cc64a9d317225382e9180295689200f564747ce7ef8b04ff7c99fef801813d3d258dad1500ede97d0b1bd804c7fce621366801e3501
|
data/Gemfile.lock
CHANGED
data/lib/rdatasets.rb
CHANGED
@@ -13,7 +13,11 @@ module RDatasets
|
|
13
13
|
if dataset_name
|
14
14
|
file_path = filepath(package_name, dataset_name)
|
15
15
|
df = Daru::DataFrame.from_csv(file_path)
|
16
|
-
|
16
|
+
if original_index_is_sequential? df
|
17
|
+
# `df.set_index` is slow
|
18
|
+
df.index = df[0]
|
19
|
+
df.delete_vector df[0].name
|
20
|
+
end
|
17
21
|
df
|
18
22
|
else
|
19
23
|
packages(package_name)
|
@@ -63,7 +67,7 @@ module RDatasets
|
|
63
67
|
|
64
68
|
# Check if the index of original r dataset is sequential.
|
65
69
|
def original_index_is_sequential?(df)
|
66
|
-
df[0].to_a == [1..df.size]
|
70
|
+
df[0].to_a == [*1..df.size]
|
67
71
|
end
|
68
72
|
private_class_method :original_index_is_sequential?
|
69
73
|
end
|
data/lib/rdatasets/version.rb
CHANGED