'datetime.datetime' has no attribute 'datetime' in pythonAttributeError: 'DataFrame' object has no attribute 'allah1__27'Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonConverting string into datetimeDoes Python have a string 'contains' substring method?

Using font to highlight a god's speech in dialogue

Where should I draw the line on follow up questions from previous employer

How to differentiate between two people with the same name in a story?

Does the Freedom of Movement spell prevent petrification by the Flesh to Stone spell?

Why haven't the British protested Brexit as ardently as the Hong Kong protesters?

A word for the urge to do the opposite

What is the practical impact of using System.Random which is not cryptographically random?

Deck of Many Things. What happens if you don't declare any number of cards and just start drawing?

Does the telecom provider need physical access to the SIM card to clone it?

How can I improve my formal definitions?

New coworker has strange workplace requirements - how should I deal with them?

What's the origin of the concept of alternate dimensions/realities?

How did the Altair 8800 front panel load the program counter?

How to draw a true pie chart?

A vector is defined to have a magnitude and *a* direction, but the zero vector has no *single* direction. So, how is the zero vector a vector?

Is the net torque changed when a partner on a seesaw stands or hangs from her end instead of sitting?

How does the search space affect the speed of an ILP solver?

How to run a command 1 out of N times in Bash

Why does the U.S. military maintain their own weather satellites?

Could a complex system of reaction wheels be used to propel a spacecraft?

Given a specific computer system, is it possible to estimate the actual precise run time of a piece of Assembly code

Is it good practice to speed up and slow down where not written in a song?

Ideas behind the 8.Bd3 line in the 4.Ng5 Two Knights Defense

apt-file regex: find multiple packages at once using or



'datetime.datetime' has no attribute 'datetime' in python


AttributeError: 'DataFrame' object has no attribute 'allah1__27'Calling an external command in PythonWhat are metaclasses in Python?Finding the index of an item given a list containing it in PythonWhat is the difference between Python's list methods append and extend?How can I safely create a nested directory?Does Python have a ternary conditional operator?Should I use the datetime or timestamp data type in MySQL?How to get the current time in PythonConverting string into datetimeDoes Python have a string 'contains' substring method?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








-5















hi i have long code maybe if you wanna check it out tell me, so im trying to solve this and I'm pretty sure the code is right but it keeps getting me the same error, i try everything to solve it but its the same i checked if the attribute missing but its there i don't know what i have done wrong
this is my code



import pandas as pd
import geopandas as gpd
import time
import pickle
import os
import numpy as np
import xgboost
import pytz
import arcgis
#
#plotting
#'''
from IPython.display import HTML, display
import datashader as ds
from datashader import transfer_functions as tf
from datashader.colors import colormap_select, Greys9, Hot, viridis, inferno
#'''

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullFormatter
import matplotlib as mpl
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
%matplotlib inline
#'''
import datetime
from pandas import Series
from datetime import datetime, timedelta
import time
from datetime import datetime, date, time, timedelta


predTimest = pd.date_range('01/06/2017', periods=7*24, freq='H',tz='US/Mountain')
predTimest
n [28]:


predTimest


Out[28]:
DatetimeIndex(['2017-01-06 00:00:00-07:00', '2017-01-06 01:00:00-07:00',
'2017-01-06 02:00:00-07:00', '2017-01-06 03:00:00-07:00',
'2017-01-06 04:00:00-07:00', '2017-01-06 05:00:00-07:00',
'2017-01-06 06:00:00-07:00', '2017-01-06 07:00:00-07:00',
'2017-01-06 08:00:00-07:00', '2017-01-06 09:00:00-07:00',
...
'2017-01-12 14:00:00-07:00', '2017-01-12 15:00:00-07:00',
'2017-01-12 16:00:00-07:00', '2017-01-12 17:00:00-07:00',
'2017-01-12 18:00:00-07:00', '2017-01-12 19:00:00-07:00',
'2017-01-12 20:00:00-07:00', '2017-01-12 21:00:00-07:00',
'2017-01-12 22:00:00-07:00', '2017-01-12 23:00:00-07:00'],
dtype='datetime64[ns, US/Mountain]', length=168, freq='H')
prediction_time = predTimest[15]
test_df = shapefile.copy()
test_df['timestamp'] = prediction_time
test_df['allah1__27'] = shapefile.allah1__27.astype('int64')
test_df['hour'] = prediction_time.hour
test_df['weekday'] = prediction_time.weekday()
test_df['month'] = prediction_time.month
def add_join_key(df):
df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
df = df.set_index('join_key')
return df
weath_df = wdf.loc[prediction_time]
test_df = add_join_key(test_df)
weath_df = add_join_key(weath_df.reset_index())


and it give me this error



---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-65-4714b1ff587e> in <module>
----> 1 test_df = add_join_key(test_df)
2 weath_df = add_join_key(weath_df.reset_index())

<ipython-input-63-1a4e6a6f2c07> in add_join_key(df)
1 def add_join_key(df):
----> 2 df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
3 df = df.set_index('join_key')
4 return df

AttributeError: type object 'datetime.datetime' has no attribute 'datetime'









share|improve this question





















  • 1





    remove one of datetime

    – Ayoub Benayache
    Mar 27 at 23:57

















-5















hi i have long code maybe if you wanna check it out tell me, so im trying to solve this and I'm pretty sure the code is right but it keeps getting me the same error, i try everything to solve it but its the same i checked if the attribute missing but its there i don't know what i have done wrong
this is my code



import pandas as pd
import geopandas as gpd
import time
import pickle
import os
import numpy as np
import xgboost
import pytz
import arcgis
#
#plotting
#'''
from IPython.display import HTML, display
import datashader as ds
from datashader import transfer_functions as tf
from datashader.colors import colormap_select, Greys9, Hot, viridis, inferno
#'''

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullFormatter
import matplotlib as mpl
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
%matplotlib inline
#'''
import datetime
from pandas import Series
from datetime import datetime, timedelta
import time
from datetime import datetime, date, time, timedelta


predTimest = pd.date_range('01/06/2017', periods=7*24, freq='H',tz='US/Mountain')
predTimest
n [28]:


predTimest


Out[28]:
DatetimeIndex(['2017-01-06 00:00:00-07:00', '2017-01-06 01:00:00-07:00',
'2017-01-06 02:00:00-07:00', '2017-01-06 03:00:00-07:00',
'2017-01-06 04:00:00-07:00', '2017-01-06 05:00:00-07:00',
'2017-01-06 06:00:00-07:00', '2017-01-06 07:00:00-07:00',
'2017-01-06 08:00:00-07:00', '2017-01-06 09:00:00-07:00',
...
'2017-01-12 14:00:00-07:00', '2017-01-12 15:00:00-07:00',
'2017-01-12 16:00:00-07:00', '2017-01-12 17:00:00-07:00',
'2017-01-12 18:00:00-07:00', '2017-01-12 19:00:00-07:00',
'2017-01-12 20:00:00-07:00', '2017-01-12 21:00:00-07:00',
'2017-01-12 22:00:00-07:00', '2017-01-12 23:00:00-07:00'],
dtype='datetime64[ns, US/Mountain]', length=168, freq='H')
prediction_time = predTimest[15]
test_df = shapefile.copy()
test_df['timestamp'] = prediction_time
test_df['allah1__27'] = shapefile.allah1__27.astype('int64')
test_df['hour'] = prediction_time.hour
test_df['weekday'] = prediction_time.weekday()
test_df['month'] = prediction_time.month
def add_join_key(df):
df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
df = df.set_index('join_key')
return df
weath_df = wdf.loc[prediction_time]
test_df = add_join_key(test_df)
weath_df = add_join_key(weath_df.reset_index())


and it give me this error



---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-65-4714b1ff587e> in <module>
----> 1 test_df = add_join_key(test_df)
2 weath_df = add_join_key(weath_df.reset_index())

<ipython-input-63-1a4e6a6f2c07> in add_join_key(df)
1 def add_join_key(df):
----> 2 df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
3 df = df.set_index('join_key')
4 return df

AttributeError: type object 'datetime.datetime' has no attribute 'datetime'









share|improve this question





















  • 1





    remove one of datetime

    – Ayoub Benayache
    Mar 27 at 23:57













-5












-5








-5








hi i have long code maybe if you wanna check it out tell me, so im trying to solve this and I'm pretty sure the code is right but it keeps getting me the same error, i try everything to solve it but its the same i checked if the attribute missing but its there i don't know what i have done wrong
this is my code



import pandas as pd
import geopandas as gpd
import time
import pickle
import os
import numpy as np
import xgboost
import pytz
import arcgis
#
#plotting
#'''
from IPython.display import HTML, display
import datashader as ds
from datashader import transfer_functions as tf
from datashader.colors import colormap_select, Greys9, Hot, viridis, inferno
#'''

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullFormatter
import matplotlib as mpl
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
%matplotlib inline
#'''
import datetime
from pandas import Series
from datetime import datetime, timedelta
import time
from datetime import datetime, date, time, timedelta


predTimest = pd.date_range('01/06/2017', periods=7*24, freq='H',tz='US/Mountain')
predTimest
n [28]:


predTimest


Out[28]:
DatetimeIndex(['2017-01-06 00:00:00-07:00', '2017-01-06 01:00:00-07:00',
'2017-01-06 02:00:00-07:00', '2017-01-06 03:00:00-07:00',
'2017-01-06 04:00:00-07:00', '2017-01-06 05:00:00-07:00',
'2017-01-06 06:00:00-07:00', '2017-01-06 07:00:00-07:00',
'2017-01-06 08:00:00-07:00', '2017-01-06 09:00:00-07:00',
...
'2017-01-12 14:00:00-07:00', '2017-01-12 15:00:00-07:00',
'2017-01-12 16:00:00-07:00', '2017-01-12 17:00:00-07:00',
'2017-01-12 18:00:00-07:00', '2017-01-12 19:00:00-07:00',
'2017-01-12 20:00:00-07:00', '2017-01-12 21:00:00-07:00',
'2017-01-12 22:00:00-07:00', '2017-01-12 23:00:00-07:00'],
dtype='datetime64[ns, US/Mountain]', length=168, freq='H')
prediction_time = predTimest[15]
test_df = shapefile.copy()
test_df['timestamp'] = prediction_time
test_df['allah1__27'] = shapefile.allah1__27.astype('int64')
test_df['hour'] = prediction_time.hour
test_df['weekday'] = prediction_time.weekday()
test_df['month'] = prediction_time.month
def add_join_key(df):
df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
df = df.set_index('join_key')
return df
weath_df = wdf.loc[prediction_time]
test_df = add_join_key(test_df)
weath_df = add_join_key(weath_df.reset_index())


and it give me this error



---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-65-4714b1ff587e> in <module>
----> 1 test_df = add_join_key(test_df)
2 weath_df = add_join_key(weath_df.reset_index())

<ipython-input-63-1a4e6a6f2c07> in add_join_key(df)
1 def add_join_key(df):
----> 2 df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
3 df = df.set_index('join_key')
4 return df

AttributeError: type object 'datetime.datetime' has no attribute 'datetime'









share|improve this question
















hi i have long code maybe if you wanna check it out tell me, so im trying to solve this and I'm pretty sure the code is right but it keeps getting me the same error, i try everything to solve it but its the same i checked if the attribute missing but its there i don't know what i have done wrong
this is my code



import pandas as pd
import geopandas as gpd
import time
import pickle
import os
import numpy as np
import xgboost
import pytz
import arcgis
#
#plotting
#'''
from IPython.display import HTML, display
import datashader as ds
from datashader import transfer_functions as tf
from datashader.colors import colormap_select, Greys9, Hot, viridis, inferno
#'''

import matplotlib.pyplot as plt
from mpl_toolkits.axes_grid1 import make_axes_locatable
from matplotlib.ticker import NullFormatter
import matplotlib as mpl
mpl.rc('xtick', color='k')
mpl.rc('ytick', color='k')
%matplotlib inline
#'''
import datetime
from pandas import Series
from datetime import datetime, timedelta
import time
from datetime import datetime, date, time, timedelta


predTimest = pd.date_range('01/06/2017', periods=7*24, freq='H',tz='US/Mountain')
predTimest
n [28]:


predTimest


Out[28]:
DatetimeIndex(['2017-01-06 00:00:00-07:00', '2017-01-06 01:00:00-07:00',
'2017-01-06 02:00:00-07:00', '2017-01-06 03:00:00-07:00',
'2017-01-06 04:00:00-07:00', '2017-01-06 05:00:00-07:00',
'2017-01-06 06:00:00-07:00', '2017-01-06 07:00:00-07:00',
'2017-01-06 08:00:00-07:00', '2017-01-06 09:00:00-07:00',
...
'2017-01-12 14:00:00-07:00', '2017-01-12 15:00:00-07:00',
'2017-01-12 16:00:00-07:00', '2017-01-12 17:00:00-07:00',
'2017-01-12 18:00:00-07:00', '2017-01-12 19:00:00-07:00',
'2017-01-12 20:00:00-07:00', '2017-01-12 21:00:00-07:00',
'2017-01-12 22:00:00-07:00', '2017-01-12 23:00:00-07:00'],
dtype='datetime64[ns, US/Mountain]', length=168, freq='H')
prediction_time = predTimest[15]
test_df = shapefile.copy()
test_df['timestamp'] = prediction_time
test_df['allah1__27'] = shapefile.allah1__27.astype('int64')
test_df['hour'] = prediction_time.hour
test_df['weekday'] = prediction_time.weekday()
test_df['month'] = prediction_time.month
def add_join_key(df):
df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
df = df.set_index('join_key')
return df
weath_df = wdf.loc[prediction_time]
test_df = add_join_key(test_df)
weath_df = add_join_key(weath_df.reset_index())


and it give me this error



---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-65-4714b1ff587e> in <module>
----> 1 test_df = add_join_key(test_df)
2 weath_df = add_join_key(weath_df.reset_index())

<ipython-input-63-1a4e6a6f2c07> in add_join_key(df)
1 def add_join_key(df):
----> 2 df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datetime.datetime.isoformat)
3 df = df.set_index('join_key')
4 return df

AttributeError: type object 'datetime.datetime' has no attribute 'datetime'






python datetime arcgis arcpy






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 28 at 23:34









desertnaut

24.7k9 gold badges55 silver badges87 bronze badges




24.7k9 gold badges55 silver badges87 bronze badges










asked Mar 27 at 23:53









Maram MubarakMaram Mubarak

181 silver badge7 bronze badges




181 silver badge7 bronze badges










  • 1





    remove one of datetime

    – Ayoub Benayache
    Mar 27 at 23:57












  • 1





    remove one of datetime

    – Ayoub Benayache
    Mar 27 at 23:57







1




1





remove one of datetime

– Ayoub Benayache
Mar 27 at 23:57





remove one of datetime

– Ayoub Benayache
Mar 27 at 23:57












2 Answers
2






active

oldest

votes


















0















You have imported datetime twice at the top of your script with the last import taking precedence:



import datetime
from datetime import datetime, timedelta


Therefore you should be calling:



datetime.isoformat





share|improve this answer

























  • i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:08











  • Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

    – cullzie
    Mar 28 at 0:13











  • how can i fix it

    – Maram Mubarak
    Mar 28 at 0:21











  • Create another question. This is unrelated to what your problem was here

    – cullzie
    Mar 28 at 0:24











  • i did here's the link stackoverflow.com/questions/55388516/…

    – Maram Mubarak
    Mar 28 at 0:37


















0















You should not import datetime and also from datetime import datetime. Best practice would be to just import datetime and then if you want the deeper module call datetime.datetime otherwise you are creating two things with the exact same name...obviously this would lead to confusion. If you really want to import both then rename one like



import datetime
from datetime import datetime as datet


Now you can refer to one as datetime and the other as datet instead of having both of them refer to the same name "datetime"






share|improve this answer



























  • @reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

    – Maram Mubarak
    Mar 28 at 0:05











  • @reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

    – Maram Mubarak
    Mar 28 at 0:14











  • Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

    – Reedinationer
    Mar 28 at 0:15











  • still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:24







  • 1





    What do you mean “still the same”? That’s clearly a different error message...

    – Reedinationer
    Mar 28 at 1:02













Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388199%2fdatetime-datetime-has-no-attribute-datetime-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









0















You have imported datetime twice at the top of your script with the last import taking precedence:



import datetime
from datetime import datetime, timedelta


Therefore you should be calling:



datetime.isoformat





share|improve this answer

























  • i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:08











  • Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

    – cullzie
    Mar 28 at 0:13











  • how can i fix it

    – Maram Mubarak
    Mar 28 at 0:21











  • Create another question. This is unrelated to what your problem was here

    – cullzie
    Mar 28 at 0:24











  • i did here's the link stackoverflow.com/questions/55388516/…

    – Maram Mubarak
    Mar 28 at 0:37















0















You have imported datetime twice at the top of your script with the last import taking precedence:



import datetime
from datetime import datetime, timedelta


Therefore you should be calling:



datetime.isoformat





share|improve this answer

























  • i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:08











  • Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

    – cullzie
    Mar 28 at 0:13











  • how can i fix it

    – Maram Mubarak
    Mar 28 at 0:21











  • Create another question. This is unrelated to what your problem was here

    – cullzie
    Mar 28 at 0:24











  • i did here's the link stackoverflow.com/questions/55388516/…

    – Maram Mubarak
    Mar 28 at 0:37













0














0










0









You have imported datetime twice at the top of your script with the last import taking precedence:



import datetime
from datetime import datetime, timedelta


Therefore you should be calling:



datetime.isoformat





share|improve this answer













You have imported datetime twice at the top of your script with the last import taking precedence:



import datetime
from datetime import datetime, timedelta


Therefore you should be calling:



datetime.isoformat






share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 27 at 23:56









cullziecullzie

1,6752 gold badges6 silver badges13 bronze badges




1,6752 gold badges6 silver badges13 bronze badges















  • i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:08











  • Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

    – cullzie
    Mar 28 at 0:13











  • how can i fix it

    – Maram Mubarak
    Mar 28 at 0:21











  • Create another question. This is unrelated to what your problem was here

    – cullzie
    Mar 28 at 0:24











  • i did here's the link stackoverflow.com/questions/55388516/…

    – Maram Mubarak
    Mar 28 at 0:37

















  • i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:08











  • Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

    – cullzie
    Mar 28 at 0:13











  • how can i fix it

    – Maram Mubarak
    Mar 28 at 0:21











  • Create another question. This is unrelated to what your problem was here

    – cullzie
    Mar 28 at 0:24











  • i did here's the link stackoverflow.com/questions/55388516/…

    – Maram Mubarak
    Mar 28 at 0:37
















i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

– Maram Mubarak
Mar 28 at 0:08





i did that before i got this error AttributeError: 'DataFrame' object has no attribute 'allah1__27'

– Maram Mubarak
Mar 28 at 0:08













Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

– cullzie
Mar 28 at 0:13





Then the DataFrame object you are passing to add_join_key does not have that column present. It is probably linked to this df weath_df since the test_df has the column you are specifying.

– cullzie
Mar 28 at 0:13













how can i fix it

– Maram Mubarak
Mar 28 at 0:21





how can i fix it

– Maram Mubarak
Mar 28 at 0:21













Create another question. This is unrelated to what your problem was here

– cullzie
Mar 28 at 0:24





Create another question. This is unrelated to what your problem was here

– cullzie
Mar 28 at 0:24













i did here's the link stackoverflow.com/questions/55388516/…

– Maram Mubarak
Mar 28 at 0:37





i did here's the link stackoverflow.com/questions/55388516/…

– Maram Mubarak
Mar 28 at 0:37













0















You should not import datetime and also from datetime import datetime. Best practice would be to just import datetime and then if you want the deeper module call datetime.datetime otherwise you are creating two things with the exact same name...obviously this would lead to confusion. If you really want to import both then rename one like



import datetime
from datetime import datetime as datet


Now you can refer to one as datetime and the other as datet instead of having both of them refer to the same name "datetime"






share|improve this answer



























  • @reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

    – Maram Mubarak
    Mar 28 at 0:05











  • @reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

    – Maram Mubarak
    Mar 28 at 0:14











  • Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

    – Reedinationer
    Mar 28 at 0:15











  • still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:24







  • 1





    What do you mean “still the same”? That’s clearly a different error message...

    – Reedinationer
    Mar 28 at 1:02















0















You should not import datetime and also from datetime import datetime. Best practice would be to just import datetime and then if you want the deeper module call datetime.datetime otherwise you are creating two things with the exact same name...obviously this would lead to confusion. If you really want to import both then rename one like



import datetime
from datetime import datetime as datet


Now you can refer to one as datetime and the other as datet instead of having both of them refer to the same name "datetime"






share|improve this answer



























  • @reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

    – Maram Mubarak
    Mar 28 at 0:05











  • @reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

    – Maram Mubarak
    Mar 28 at 0:14











  • Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

    – Reedinationer
    Mar 28 at 0:15











  • still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:24







  • 1





    What do you mean “still the same”? That’s clearly a different error message...

    – Reedinationer
    Mar 28 at 1:02













0














0










0









You should not import datetime and also from datetime import datetime. Best practice would be to just import datetime and then if you want the deeper module call datetime.datetime otherwise you are creating two things with the exact same name...obviously this would lead to confusion. If you really want to import both then rename one like



import datetime
from datetime import datetime as datet


Now you can refer to one as datetime and the other as datet instead of having both of them refer to the same name "datetime"






share|improve this answer















You should not import datetime and also from datetime import datetime. Best practice would be to just import datetime and then if you want the deeper module call datetime.datetime otherwise you are creating two things with the exact same name...obviously this would lead to confusion. If you really want to import both then rename one like



import datetime
from datetime import datetime as datet


Now you can refer to one as datetime and the other as datet instead of having both of them refer to the same name "datetime"







share|improve this answer














share|improve this answer



share|improve this answer








edited Mar 28 at 0:07

























answered Mar 27 at 23:57









ReedinationerReedinationer

4,0801 gold badge4 silver badges27 bronze badges




4,0801 gold badge4 silver badges27 bronze badges















  • @reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

    – Maram Mubarak
    Mar 28 at 0:05











  • @reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

    – Maram Mubarak
    Mar 28 at 0:14











  • Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

    – Reedinationer
    Mar 28 at 0:15











  • still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:24







  • 1





    What do you mean “still the same”? That’s clearly a different error message...

    – Reedinationer
    Mar 28 at 1:02

















  • @reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

    – Maram Mubarak
    Mar 28 at 0:05











  • @reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

    – Maram Mubarak
    Mar 28 at 0:14











  • Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

    – Reedinationer
    Mar 28 at 0:15











  • still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

    – Maram Mubarak
    Mar 28 at 0:24







  • 1





    What do you mean “still the same”? That’s clearly a different error message...

    – Reedinationer
    Mar 28 at 1:02
















@reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

– Maram Mubarak
Mar 28 at 0:05





@reedinarioner i did that already, but I don't know what are you meaning by that "exact same name"

– Maram Mubarak
Mar 28 at 0:05













@reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

– Maram Mubarak
Mar 28 at 0:14





@reedinarioner i did what you say i import datetime only and i get AttributeError: module 'datetime' has no attribute 'isoformat'

– Maram Mubarak
Mar 28 at 0:14













Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

– Reedinationer
Mar 28 at 0:15





Right. If you've renamed it then it would be datet.isoformat. After renaming it you have to use the new name to access it

– Reedinationer
Mar 28 at 0:15













still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

– Maram Mubarak
Mar 28 at 0:24






still the same def add_join_key(df): df['join_key'] = df.allah1__27.map(int).map(str)+df.timestamp.map(datet.isoformat) df = df.set_index('join_key') return df AttributeError: 'DataFrame' object has no attribute 'allah1__27'

– Maram Mubarak
Mar 28 at 0:24





1




1





What do you mean “still the same”? That’s clearly a different error message...

– Reedinationer
Mar 28 at 1:02





What do you mean “still the same”? That’s clearly a different error message...

– Reedinationer
Mar 28 at 1:02

















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55388199%2fdatetime-datetime-has-no-attribute-datetime-in-python%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현