# ERROR: MethodError: no method matching adjoint(::DateTime)

**URL:** <https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230>\
**Category:** New to Julia\
**Tags:** data, data\_structures\
**Created:** [September 15, 2021, 9:10pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230 "2021-09-15T21:10:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jhgorse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jhgorse/32/28979_2.png) [@jhgorse](https://discourse.julialang.org/u/jhgorse)\
**Post date:** [September 15, 2021, 9:10pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230/1 "2021-09-15T21:10:01Z")

</div>

Hello,

I am struggling with Julia’s less than MATLAB capability for transposing matrices (row data).

I parse a file into a temporary vector. I transpose the vector and append to the matrix. Neither before nor after the transposing can I succeed at having the element a native DateTime type.

```julia
[DateTime(0) 0]' # fails

```

while this succeeds to create and append a row as desired:

```julia
julia> x = [DateTime(0) 0]
1×2 Matrix{Any}:
 0000-01-01T00:00:00 0
julia> [x; x]
2×2 Matrix{Any}:
 0000-01-01T00:00:00 0
 0000-01-01T00:00:00 0

```

Currently I take a vector with the unix timestamp, transpose it, then try to convert the first element back to DateTime. This does not work because I create a 1x2 adjoint vector rather than a 1x2 matrix as desired.

How do I avoid the Adjoint mess and insert this element into my data stream?

Cheers,  
Joe

---

<div class="post-metadata">

**Author:** ![jhgorse](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jhgorse/32/28979_2.png) [@jhgorse](https://discourse.julialang.org/u/jhgorse)\
**Post date:** [September 15, 2021, 9:16pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230/2 "2021-09-15T21:16:46Z")

</div>

Solved using `reshape()` to specify the 1x15 Matrix rather than adjoint type.

This feature of the language certainly violated the principle of least surprise here, so any commentary is welcome.

Cheers,  
Joe

---

<div class="post-metadata">

**Author:** ![kristoffer.carlsson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/kristoffer.carlsson/32/22_2.png) [@kristoffer.carlsson](https://discourse.julialang.org/u/kristoffer.carlsson)\
**Post date:** [September 15, 2021, 10:00pm UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230/3 "2021-09-15T22:00:57Z")

</div>

> [@jhgorse](#):
>
> This feature of the language certainly violated the principle of least surprise here, so any commentary is welcome.

`'` postfix is the syntax for adjoint which is applied recursively and is a linear algebra concept. The adjoint of a date doesn’t make sense which is why it errors.

---

<div class="post-metadata">

**Author:** ![mcabbott](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/mcabbott/32/6603_2.png) [@mcabbott](https://discourse.julialang.org/u/mcabbott)\
**Post date:** [September 16, 2021, 12:42am UTC](https://discourse.julialang.org/t/error-methoderror-no-method-matching-adjoint-datetime/68230/4 "2021-09-16T00:42:00Z")

</div>

While I agree it’s slightly surprising, the recommended function for arrays of various objects is `permutedims`. (Which, on a vector, is precisely `reshape`.)

```julia
help?> adjoint
search: adjoint adjoint! Adjoint

  A'
  adjoint(A)

  Lazy adjoint (conjugate transposition). Note that adjoint is applied recursively to elements.

  For number types, adjoint returns the complex conjugate, and therefore it is equivalent to the
  identity function for real numbers.

  This operation is intended for linear algebra usage - for general data manipulation see
  permutedims.

```
