Skip to content

Commit 4cb7216

Browse files
removing old redundant code that yields SettingWithCopyWarning, remove depracated inplace, and fix hanging tests (#88)
* removing old redundant code that is causing SettingWithCopyWarning * fix conftest that was using different oauth2 flow
1 parent da38bc4 commit 4cb7216

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

gspread_pandas/util.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import warnings
2-
from distutils.version import StrictVersion
32
from re import match
43
from time import sleep
54

@@ -217,13 +216,7 @@ def fillna(df, fill_value=""):
217216
"""
218217
for col in df.dtypes[df.dtypes == "category"].index:
219218
if fill_value not in df[col].cat.categories:
220-
df[col].cat.add_categories([fill_value], inplace=True)
221-
# Known bug https://github.com/pandas-dev/pandas/issues/25472
222-
if StrictVersion(pd.__version__) >= StrictVersion("1.0"):
223-
for col in df.dtypes[
224-
df.dtypes.apply(lambda x: x in ["float64", "int16"])
225-
].index:
226-
df[col] = df[col].astype("float")
219+
df[col] = df[col].cat.add_categories([fill_value])
227220
return df.fillna(fill_value)
228221

229222

tests/conf_test.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,18 +45,18 @@ def test_oauth_no_key(self, set_oauth_config):
4545
conf.get_creds(user=None)
4646

4747
def test_oauth_first_time(self, mocker, set_oauth_config, creds_json):
48-
mocked = mocker.patch.object(conf.InstalledAppFlow, "run_console")
48+
mocked = mocker.patch.object(conf.InstalledAppFlow, "run_local_server")
4949
mocked.return_value = OAuth2Credentials.from_authorized_user_info(creds_json)
5050
conf.get_creds()
5151
# python 3.5 doesn't have assert_called_once
5252
assert mocked.call_count == 1
5353
assert (conf.get_config_dir() / "creds" / "default").exists()
5454

5555
def test_oauth_first_time_no_save(self, mocker, set_oauth_config):
56-
mocker.patch.object(conf.InstalledAppFlow, "run_console")
56+
mocker.patch.object(conf.InstalledAppFlow, "run_local_server")
5757
conf.get_creds(save=False)
5858
# python 3.5 doesn't have assert_called_once
59-
assert conf.InstalledAppFlow.run_console.call_count == 1
59+
assert conf.InstalledAppFlow.run_local_server.call_count == 1
6060

6161
def test_oauth_default(self, make_creds):
6262
assert isinstance(conf.get_creds(), OAuth2Credentials)

0 commit comments

Comments
 (0)