Reputation: 41
I have to do a project for my class based on the kaggle competition twosigma but the problem comes when I try to import my dataset from kaggle.competitions. Can anyone help me?
This is the code I found:
import pandas as pd
import numpy as np
import time
import lightgbm as lgb
from sklearn.metrics import mean_squared_error
from sklearn.model_selection import KFold
import matplotlib.pyplot as plt
import seaborn as sns
plt.style.use('seaborn')
sns.set(font_scale=2)
import warnings
warnings.filterwarnings('ignore')
import os
from kaggle.competitions import twosigmanews
# You can only call make_env() once, so don't lose it!
env = twosigmanews.make_env()
print('Done!')
This is the error I have:
ValueError Traceback (most recent call last)
<ipython-input-4-25118fdba524> in <module>()
----> 1 from kaggle.competitions import twosigmanews
2 # You can only call make_env() once, so don't lose it!
3 env = twosigmanews.make_env()
4 print('Done!')
~\Anaconda3\lib\site-packages\kaggle\__init__.py in <module>()
21
22 api = KaggleApi(ApiClient())
---> 23 api.authenticate()
~\Anaconda3\lib\site-packages\kaggle\api\kaggle_api_extended.py in
authenticate(self)
108
109 # Step 3: load into configuration!
--> 110 self._load_config(config_data)
111
112 def read_config_environment(self, config_data={}, quiet=False):
~\Anaconda3\lib\site-packages\kaggle\api\kaggle_api_extended.py in
_load_config(self, config_data)
147 for item in [self.CONFIG_NAME_USER, self.CONFIG_NAME_KEY]:
148 if item not in config_data:
--> 149 raise ValueError('Error: Missing %s in
configuration.' % item)
150
151 configuration = Configuration()
ValueError: Error: Missing username in configuration.
Upvotes: 0
Views: 1407
Reputation: 289
It seems to be related to the incorrect location of the Kaggle configuration file.
Also, check below related answer:
Error while importing Kaggle dataset on Colab
Upvotes: 1