Padding a column of listsManipulating list of matricesplotting all solutions of differential equations for many parametersDataset column stubs in query resultPadding lists for accurate plottingApply function with multiple arguments to column in dataset

Printing a list as "a, b, c." using Python

Why is there no Disney logo in MCU movies?

How can I portray a character with no fear of death, without them sounding utterly bored?

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

Can authors email you PDFs of their textbook for free?

What are the in-game differences between WoW Classic and the original 2006 Version

In what language did Túrin converse with Mím?

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

Can two aircraft be allowed to stay on the same runway at the same time?

How to investigate an unknown 1.5GB file named "sudo" in my Linux home directory?

Necessity of tenure for lifetime academic research

How to animate a function plot

Eshet Chayil in the Tunisian service

Create a list of snaking numbers under 50,000

Why did I get UK entry stamps in my British passport?

Properly unlinking hard links

math mode in ticks ( tikzpicture )

Can inductive kick be discharged without freewheeling diode, in this example?

What's the difference between a variable and a memory location?

Don't look at what I did there

What are ways to record who took the pictures if a camera is used by multiple people?

Which language is the closest lexically to Spanish?

Is Borg adaptation only temporary?

Is "prohibition against," a double negative?



Padding a column of lists


Manipulating list of matricesplotting all solutions of differential equations for many parametersDataset column stubs in query resultPadding lists for accurate plottingApply function with multiple arguments to column in dataset






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








3












$begingroup$


I have data in the the form of a table, whose one column is the following



1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
4.38177,
4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636,
2.0672,
2.06916,
2.06951


I want to pad the single elements from left and right with Null and bring the above into the following form



 1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
Null, Null, 4.38177,
Null, Null, 4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636, Null, Null,
2.0672, Null, Null,
2.06916, Null, Null,
2.06951, Null, Null









share|improve this question









$endgroup$













  • $begingroup$
    PadLeft[list, Automatic, Null] pads on the left with Null.
    $endgroup$
    – kglr
    8 hours ago










  • $begingroup$
    and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    @kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
    $endgroup$
    – AtoZ
    8 hours ago


















3












$begingroup$


I have data in the the form of a table, whose one column is the following



1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
4.38177,
4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636,
2.0672,
2.06916,
2.06951


I want to pad the single elements from left and right with Null and bring the above into the following form



 1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
Null, Null, 4.38177,
Null, Null, 4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636, Null, Null,
2.0672, Null, Null,
2.06916, Null, Null,
2.06951, Null, Null









share|improve this question









$endgroup$













  • $begingroup$
    PadLeft[list, Automatic, Null] pads on the left with Null.
    $endgroup$
    – kglr
    8 hours ago










  • $begingroup$
    and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    @kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
    $endgroup$
    – AtoZ
    8 hours ago














3












3








3


1



$begingroup$


I have data in the the form of a table, whose one column is the following



1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
4.38177,
4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636,
2.0672,
2.06916,
2.06951


I want to pad the single elements from left and right with Null and bring the above into the following form



 1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
Null, Null, 4.38177,
Null, Null, 4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636, Null, Null,
2.0672, Null, Null,
2.06916, Null, Null,
2.06951, Null, Null









share|improve this question









$endgroup$




I have data in the the form of a table, whose one column is the following



1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
4.38177,
4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636,
2.0672,
2.06916,
2.06951


I want to pad the single elements from left and right with Null and bring the above into the following form



 1.94238, 1.94361, 4.72888,
1.94477, 1.94938, 4.71431,
1.94893, 1.95817, 4.69017,
1.9551, 1.96907, 4.65627,
1.9637, 1.98115, 4.61168,
1.97539, 1.99357, 4.55427,
1.99141, 2.00535, 4.48002,
Null, Null, 4.38177,
Null, Null, 4.24668,
2.04454, 2.07149, 4.05151,
2.05173, 2.13016, 3.75524,
2.05838, 2.23059, 3.29844,
2.0636, Null, Null,
2.0672, Null, Null,
2.06916, Null, Null,
2.06951, Null, Null






list-manipulation dataset






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked 8 hours ago









AtoZAtoZ

1876 bronze badges




1876 bronze badges














  • $begingroup$
    PadLeft[list, Automatic, Null] pads on the left with Null.
    $endgroup$
    – kglr
    8 hours ago










  • $begingroup$
    and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    @kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
    $endgroup$
    – AtoZ
    8 hours ago

















  • $begingroup$
    PadLeft[list, Automatic, Null] pads on the left with Null.
    $endgroup$
    – kglr
    8 hours ago










  • $begingroup$
    and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
    $endgroup$
    – kglr
    8 hours ago











  • $begingroup$
    @kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
    $endgroup$
    – AtoZ
    8 hours ago
















$begingroup$
PadLeft[list, Automatic, Null] pads on the left with Null.
$endgroup$
– kglr
8 hours ago




$begingroup$
PadLeft[list, Automatic, Null] pads on the left with Null.
$endgroup$
– kglr
8 hours ago












$begingroup$
and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
$endgroup$
– kglr
8 hours ago





$begingroup$
and PadRight[list, Automatic, Null] pads on the right. you need to provide the row number ( or the rule) to switch between left and right padding.
$endgroup$
– kglr
8 hours ago













$begingroup$
@kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
$endgroup$
– AtoZ
8 hours ago





$begingroup$
@kglr Thanks, just counting from 1, from the top. For instance, if this varies from column to column, is there then a generic rule to do such right and left padding? I mean if the row number containing the list to be padded varies?
$endgroup$
– AtoZ
8 hours ago











2 Answers
2






active

oldest

votes


















4













$begingroup$

list = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
4.55427, 1.99141, 2.00535, 4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
3.29844, 2.0636, 2.0672, 2.06916, 2.06951;


You can use PadLeft and PadRight:



list1 = PadLeft[list, Automatic, Null];

TeXForm @ MatrixForm[list1]



$tiny left(
beginarrayccc
1.94238 & 1.94361 & 4.72888 \
1.94477 & 1.94938 & 4.71431 \
1.94893 & 1.95817 & 4.69017 \
1.9551 & 1.96907 & 4.65627 \
1.9637 & 1.98115 & 4.61168 \
1.97539 & 1.99357 & 4.55427 \
1.99141 & 2.00535 & 4.48002 \
textNull & textNull & 4.38177 \
textNull & textNull & 4.24668 \
2.04454 & 2.07149 & 4.05151 \
2.05173 & 2.13016 & 3.75524 \
2.05838 & 2.23059 & 3.29844 \
textNull & textNull & 2.0636 \
textNull & textNull & 2.0672 \
textNull & textNull & 2.06916 \
textNull & textNull & 2.06951 \
endarray
right)$




Tow switch from left padding to right padding after row t:



t = 10;
list2 = list;
list2[[;; t]] = PadLeft[list2[[;; t]], Automatic, Null];
list2[[t + 1 ;;]] = PadRight[list2[[t + 1 ;;]], Automatic, Null];

TeXForm @ MatrixForm[list2]



$tiny left(
beginarrayccc
1.94238 & 1.94361 & 4.72888 \
1.94477 & 1.94938 & 4.71431 \
1.94893 & 1.95817 & 4.69017 \
1.9551 & 1.96907 & 4.65627 \
1.9637 & 1.98115 & 4.61168 \
1.97539 & 1.99357 & 4.55427 \
1.99141 & 2.00535 & 4.48002 \
textNull & textNull & 4.38177 \
textNull & textNull & 4.24668 \
2.04454 & 2.07149 & 4.05151 \
2.05173 & 2.13016 & 3.75524 \
2.05838 & 2.23059 & 3.29844 \
2.0636 & textNull & textNull \
2.0672 & textNull & textNull \
2.06916 & textNull & textNull \
2.06951 & textNull & textNull \
endarray
right)$




To pad left at rows in the list leftpaddedrows and right at rows in the list rightpaddedrows:



SeedRandom[1]
leftpaddedrows = RandomSample[Range@Length@list, 10];
rightpaddedrows = Complement[Range[Length@list], leftpaddedrows];

list3 = list;
list3[[leftpaddedrows]] = PadLeft[list3[[leftpaddedrows]], Automatic, Null];
list3[[rightpaddedrows]] = PadRight[list3[[rightpaddedrows]], Automatic, Null];

TeXForm @ MatrixForm[list3]



$tiny left(
beginarrayccc
1.94238 & 1.94361 & 4.72888 \
1.94477 & 1.94938 & 4.71431 \
1.94893 & 1.95817 & 4.69017 \
1.9551 & 1.96907 & 4.65627 \
1.9637 & 1.98115 & 4.61168 \
1.97539 & 1.99357 & 4.55427 \
1.99141 & 2.00535 & 4.48002 \
textNull & textNull & 4.38177 \
textNull & textNull & 4.24668 \
2.04454 & 2.07149 & 4.05151 \
2.05173 & 2.13016 & 3.75524 \
2.05838 & 2.23059 & 3.29844 \
textNull & textNull & 2.0636 \
textNull & textNull & 2.0672 \
2.06916 & textNull & textNull \
2.06951 & textNull & textNull \
endarray
right)$







share|improve this answer











$endgroup$






















    1













    $begingroup$

    Another approach if you want to left pad the first n one-element lists and right pad the rest is:



    lst = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
    4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
    4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
    4.55427, 1.99141, 2.00535,
    4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
    4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
    3.29844, 2.0636, 2.0672, 2.06916, 2.06951


    Followed by calls to SequenceReplace:



    nlst = SequenceReplace[lst, x_ :> Null, Null, x, 2];
    alst = SequenceReplace[nlst, x_ :> x, Null, Null] // TableForm


    enter image description here






    share|improve this answer









    $endgroup$

















      Your Answer








      StackExchange.ready(function()
      var channelOptions =
      tags: "".split(" "),
      id: "387"
      ;
      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: false,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: null,
      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%2fmathematica.stackexchange.com%2fquestions%2f204570%2fpadding-a-column-of-lists%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









      4













      $begingroup$

      list = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
      4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
      4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
      4.55427, 1.99141, 2.00535, 4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
      4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
      3.29844, 2.0636, 2.0672, 2.06916, 2.06951;


      You can use PadLeft and PadRight:



      list1 = PadLeft[list, Automatic, Null];

      TeXForm @ MatrixForm[list1]



      $tiny left(
      beginarrayccc
      1.94238 & 1.94361 & 4.72888 \
      1.94477 & 1.94938 & 4.71431 \
      1.94893 & 1.95817 & 4.69017 \
      1.9551 & 1.96907 & 4.65627 \
      1.9637 & 1.98115 & 4.61168 \
      1.97539 & 1.99357 & 4.55427 \
      1.99141 & 2.00535 & 4.48002 \
      textNull & textNull & 4.38177 \
      textNull & textNull & 4.24668 \
      2.04454 & 2.07149 & 4.05151 \
      2.05173 & 2.13016 & 3.75524 \
      2.05838 & 2.23059 & 3.29844 \
      textNull & textNull & 2.0636 \
      textNull & textNull & 2.0672 \
      textNull & textNull & 2.06916 \
      textNull & textNull & 2.06951 \
      endarray
      right)$




      Tow switch from left padding to right padding after row t:



      t = 10;
      list2 = list;
      list2[[;; t]] = PadLeft[list2[[;; t]], Automatic, Null];
      list2[[t + 1 ;;]] = PadRight[list2[[t + 1 ;;]], Automatic, Null];

      TeXForm @ MatrixForm[list2]



      $tiny left(
      beginarrayccc
      1.94238 & 1.94361 & 4.72888 \
      1.94477 & 1.94938 & 4.71431 \
      1.94893 & 1.95817 & 4.69017 \
      1.9551 & 1.96907 & 4.65627 \
      1.9637 & 1.98115 & 4.61168 \
      1.97539 & 1.99357 & 4.55427 \
      1.99141 & 2.00535 & 4.48002 \
      textNull & textNull & 4.38177 \
      textNull & textNull & 4.24668 \
      2.04454 & 2.07149 & 4.05151 \
      2.05173 & 2.13016 & 3.75524 \
      2.05838 & 2.23059 & 3.29844 \
      2.0636 & textNull & textNull \
      2.0672 & textNull & textNull \
      2.06916 & textNull & textNull \
      2.06951 & textNull & textNull \
      endarray
      right)$




      To pad left at rows in the list leftpaddedrows and right at rows in the list rightpaddedrows:



      SeedRandom[1]
      leftpaddedrows = RandomSample[Range@Length@list, 10];
      rightpaddedrows = Complement[Range[Length@list], leftpaddedrows];

      list3 = list;
      list3[[leftpaddedrows]] = PadLeft[list3[[leftpaddedrows]], Automatic, Null];
      list3[[rightpaddedrows]] = PadRight[list3[[rightpaddedrows]], Automatic, Null];

      TeXForm @ MatrixForm[list3]



      $tiny left(
      beginarrayccc
      1.94238 & 1.94361 & 4.72888 \
      1.94477 & 1.94938 & 4.71431 \
      1.94893 & 1.95817 & 4.69017 \
      1.9551 & 1.96907 & 4.65627 \
      1.9637 & 1.98115 & 4.61168 \
      1.97539 & 1.99357 & 4.55427 \
      1.99141 & 2.00535 & 4.48002 \
      textNull & textNull & 4.38177 \
      textNull & textNull & 4.24668 \
      2.04454 & 2.07149 & 4.05151 \
      2.05173 & 2.13016 & 3.75524 \
      2.05838 & 2.23059 & 3.29844 \
      textNull & textNull & 2.0636 \
      textNull & textNull & 2.0672 \
      2.06916 & textNull & textNull \
      2.06951 & textNull & textNull \
      endarray
      right)$







      share|improve this answer











      $endgroup$



















        4













        $begingroup$

        list = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
        4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
        4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
        4.55427, 1.99141, 2.00535, 4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
        4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
        3.29844, 2.0636, 2.0672, 2.06916, 2.06951;


        You can use PadLeft and PadRight:



        list1 = PadLeft[list, Automatic, Null];

        TeXForm @ MatrixForm[list1]



        $tiny left(
        beginarrayccc
        1.94238 & 1.94361 & 4.72888 \
        1.94477 & 1.94938 & 4.71431 \
        1.94893 & 1.95817 & 4.69017 \
        1.9551 & 1.96907 & 4.65627 \
        1.9637 & 1.98115 & 4.61168 \
        1.97539 & 1.99357 & 4.55427 \
        1.99141 & 2.00535 & 4.48002 \
        textNull & textNull & 4.38177 \
        textNull & textNull & 4.24668 \
        2.04454 & 2.07149 & 4.05151 \
        2.05173 & 2.13016 & 3.75524 \
        2.05838 & 2.23059 & 3.29844 \
        textNull & textNull & 2.0636 \
        textNull & textNull & 2.0672 \
        textNull & textNull & 2.06916 \
        textNull & textNull & 2.06951 \
        endarray
        right)$




        Tow switch from left padding to right padding after row t:



        t = 10;
        list2 = list;
        list2[[;; t]] = PadLeft[list2[[;; t]], Automatic, Null];
        list2[[t + 1 ;;]] = PadRight[list2[[t + 1 ;;]], Automatic, Null];

        TeXForm @ MatrixForm[list2]



        $tiny left(
        beginarrayccc
        1.94238 & 1.94361 & 4.72888 \
        1.94477 & 1.94938 & 4.71431 \
        1.94893 & 1.95817 & 4.69017 \
        1.9551 & 1.96907 & 4.65627 \
        1.9637 & 1.98115 & 4.61168 \
        1.97539 & 1.99357 & 4.55427 \
        1.99141 & 2.00535 & 4.48002 \
        textNull & textNull & 4.38177 \
        textNull & textNull & 4.24668 \
        2.04454 & 2.07149 & 4.05151 \
        2.05173 & 2.13016 & 3.75524 \
        2.05838 & 2.23059 & 3.29844 \
        2.0636 & textNull & textNull \
        2.0672 & textNull & textNull \
        2.06916 & textNull & textNull \
        2.06951 & textNull & textNull \
        endarray
        right)$




        To pad left at rows in the list leftpaddedrows and right at rows in the list rightpaddedrows:



        SeedRandom[1]
        leftpaddedrows = RandomSample[Range@Length@list, 10];
        rightpaddedrows = Complement[Range[Length@list], leftpaddedrows];

        list3 = list;
        list3[[leftpaddedrows]] = PadLeft[list3[[leftpaddedrows]], Automatic, Null];
        list3[[rightpaddedrows]] = PadRight[list3[[rightpaddedrows]], Automatic, Null];

        TeXForm @ MatrixForm[list3]



        $tiny left(
        beginarrayccc
        1.94238 & 1.94361 & 4.72888 \
        1.94477 & 1.94938 & 4.71431 \
        1.94893 & 1.95817 & 4.69017 \
        1.9551 & 1.96907 & 4.65627 \
        1.9637 & 1.98115 & 4.61168 \
        1.97539 & 1.99357 & 4.55427 \
        1.99141 & 2.00535 & 4.48002 \
        textNull & textNull & 4.38177 \
        textNull & textNull & 4.24668 \
        2.04454 & 2.07149 & 4.05151 \
        2.05173 & 2.13016 & 3.75524 \
        2.05838 & 2.23059 & 3.29844 \
        textNull & textNull & 2.0636 \
        textNull & textNull & 2.0672 \
        2.06916 & textNull & textNull \
        2.06951 & textNull & textNull \
        endarray
        right)$







        share|improve this answer











        $endgroup$

















          4














          4










          4







          $begingroup$

          list = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
          4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
          4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
          4.55427, 1.99141, 2.00535, 4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
          4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
          3.29844, 2.0636, 2.0672, 2.06916, 2.06951;


          You can use PadLeft and PadRight:



          list1 = PadLeft[list, Automatic, Null];

          TeXForm @ MatrixForm[list1]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          textNull & textNull & 2.0636 \
          textNull & textNull & 2.0672 \
          textNull & textNull & 2.06916 \
          textNull & textNull & 2.06951 \
          endarray
          right)$




          Tow switch from left padding to right padding after row t:



          t = 10;
          list2 = list;
          list2[[;; t]] = PadLeft[list2[[;; t]], Automatic, Null];
          list2[[t + 1 ;;]] = PadRight[list2[[t + 1 ;;]], Automatic, Null];

          TeXForm @ MatrixForm[list2]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          2.0636 & textNull & textNull \
          2.0672 & textNull & textNull \
          2.06916 & textNull & textNull \
          2.06951 & textNull & textNull \
          endarray
          right)$




          To pad left at rows in the list leftpaddedrows and right at rows in the list rightpaddedrows:



          SeedRandom[1]
          leftpaddedrows = RandomSample[Range@Length@list, 10];
          rightpaddedrows = Complement[Range[Length@list], leftpaddedrows];

          list3 = list;
          list3[[leftpaddedrows]] = PadLeft[list3[[leftpaddedrows]], Automatic, Null];
          list3[[rightpaddedrows]] = PadRight[list3[[rightpaddedrows]], Automatic, Null];

          TeXForm @ MatrixForm[list3]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          textNull & textNull & 2.0636 \
          textNull & textNull & 2.0672 \
          2.06916 & textNull & textNull \
          2.06951 & textNull & textNull \
          endarray
          right)$







          share|improve this answer











          $endgroup$



          list = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
          4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
          4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
          4.55427, 1.99141, 2.00535, 4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
          4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
          3.29844, 2.0636, 2.0672, 2.06916, 2.06951;


          You can use PadLeft and PadRight:



          list1 = PadLeft[list, Automatic, Null];

          TeXForm @ MatrixForm[list1]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          textNull & textNull & 2.0636 \
          textNull & textNull & 2.0672 \
          textNull & textNull & 2.06916 \
          textNull & textNull & 2.06951 \
          endarray
          right)$




          Tow switch from left padding to right padding after row t:



          t = 10;
          list2 = list;
          list2[[;; t]] = PadLeft[list2[[;; t]], Automatic, Null];
          list2[[t + 1 ;;]] = PadRight[list2[[t + 1 ;;]], Automatic, Null];

          TeXForm @ MatrixForm[list2]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          2.0636 & textNull & textNull \
          2.0672 & textNull & textNull \
          2.06916 & textNull & textNull \
          2.06951 & textNull & textNull \
          endarray
          right)$




          To pad left at rows in the list leftpaddedrows and right at rows in the list rightpaddedrows:



          SeedRandom[1]
          leftpaddedrows = RandomSample[Range@Length@list, 10];
          rightpaddedrows = Complement[Range[Length@list], leftpaddedrows];

          list3 = list;
          list3[[leftpaddedrows]] = PadLeft[list3[[leftpaddedrows]], Automatic, Null];
          list3[[rightpaddedrows]] = PadRight[list3[[rightpaddedrows]], Automatic, Null];

          TeXForm @ MatrixForm[list3]



          $tiny left(
          beginarrayccc
          1.94238 & 1.94361 & 4.72888 \
          1.94477 & 1.94938 & 4.71431 \
          1.94893 & 1.95817 & 4.69017 \
          1.9551 & 1.96907 & 4.65627 \
          1.9637 & 1.98115 & 4.61168 \
          1.97539 & 1.99357 & 4.55427 \
          1.99141 & 2.00535 & 4.48002 \
          textNull & textNull & 4.38177 \
          textNull & textNull & 4.24668 \
          2.04454 & 2.07149 & 4.05151 \
          2.05173 & 2.13016 & 3.75524 \
          2.05838 & 2.23059 & 3.29844 \
          textNull & textNull & 2.0636 \
          textNull & textNull & 2.0672 \
          2.06916 & textNull & textNull \
          2.06951 & textNull & textNull \
          endarray
          right)$








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 8 hours ago

























          answered 8 hours ago









          kglrkglr

          214k10 gold badges245 silver badges490 bronze badges




          214k10 gold badges245 silver badges490 bronze badges


























              1













              $begingroup$

              Another approach if you want to left pad the first n one-element lists and right pad the rest is:



              lst = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
              4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
              4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
              4.55427, 1.99141, 2.00535,
              4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
              4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
              3.29844, 2.0636, 2.0672, 2.06916, 2.06951


              Followed by calls to SequenceReplace:



              nlst = SequenceReplace[lst, x_ :> Null, Null, x, 2];
              alst = SequenceReplace[nlst, x_ :> x, Null, Null] // TableForm


              enter image description here






              share|improve this answer









              $endgroup$



















                1













                $begingroup$

                Another approach if you want to left pad the first n one-element lists and right pad the rest is:



                lst = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
                4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
                4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
                4.55427, 1.99141, 2.00535,
                4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
                4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
                3.29844, 2.0636, 2.0672, 2.06916, 2.06951


                Followed by calls to SequenceReplace:



                nlst = SequenceReplace[lst, x_ :> Null, Null, x, 2];
                alst = SequenceReplace[nlst, x_ :> x, Null, Null] // TableForm


                enter image description here






                share|improve this answer









                $endgroup$

















                  1














                  1










                  1







                  $begingroup$

                  Another approach if you want to left pad the first n one-element lists and right pad the rest is:



                  lst = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
                  4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
                  4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
                  4.55427, 1.99141, 2.00535,
                  4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
                  4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
                  3.29844, 2.0636, 2.0672, 2.06916, 2.06951


                  Followed by calls to SequenceReplace:



                  nlst = SequenceReplace[lst, x_ :> Null, Null, x, 2];
                  alst = SequenceReplace[nlst, x_ :> x, Null, Null] // TableForm


                  enter image description here






                  share|improve this answer









                  $endgroup$



                  Another approach if you want to left pad the first n one-element lists and right pad the rest is:



                  lst = 1.94238, 1.94361, 4.72888, 1.94477, 1.94938, 
                  4.71431, 1.94893, 1.95817, 4.69017, 1.9551, 1.96907,
                  4.65627, 1.9637, 1.98115, 4.61168, 1.97539, 1.99357,
                  4.55427, 1.99141, 2.00535,
                  4.48002, 4.38177, 4.24668, 2.04454, 2.07149,
                  4.05151, 2.05173, 2.13016, 3.75524, 2.05838, 2.23059,
                  3.29844, 2.0636, 2.0672, 2.06916, 2.06951


                  Followed by calls to SequenceReplace:



                  nlst = SequenceReplace[lst, x_ :> Null, Null, x, 2];
                  alst = SequenceReplace[nlst, x_ :> x, Null, Null] // TableForm


                  enter image description here







                  share|improve this answer












                  share|improve this answer



                  share|improve this answer










                  answered 2 hours ago









                  LeeLee

                  6292 silver badges8 bronze badges




                  6292 silver badges8 bronze badges






























                      draft saved

                      draft discarded
















































                      Thanks for contributing an answer to Mathematica Stack Exchange!


                      • 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.

                      Use MathJax to format equations. MathJax reference.


                      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%2fmathematica.stackexchange.com%2fquestions%2f204570%2fpadding-a-column-of-lists%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

                      Invision Community Contents History See also References External links Navigation menuProprietaryinvisioncommunity.comIPS Community ForumsIPS Community Forumsthis blog entry"License Changes, IP.Board 3.4, and the Future""Interview -- Matt Mecham of Ibforums""CEO Invision Power Board, Matt Mecham Is a Liar, Thief!"IPB License Explanation 1.3, 1.3.1, 2.0, and 2.1ArchivedSecurity Fixes, Updates And Enhancements For IPB 1.3.1Archived"New Demo Accounts - Invision Power Services"the original"New Default Skin"the original"Invision Power Board 3.0.0 and Applications Released"the original"Archived copy"the original"Perpetual licenses being done away with""Release Notes - Invision Power Services""Introducing: IPS Community Suite 4!"Invision Community Release Notes

                      Canceling a color specificationRandomly assigning color to Graphics3D objects?Default color for Filling in Mathematica 9Coloring specific elements of sets with a prime modified order in an array plotHow to pick a color differing significantly from the colors already in a given color list?Detection of the text colorColor numbers based on their valueCan color schemes for use with ColorData include opacity specification?My dynamic color schemes

                      Ласкавець круглолистий Зміст Опис | Поширення | Галерея | Примітки | Посилання | Навігаційне меню58171138361-22960890446Bupleurum rotundifoliumEuro+Med PlantbasePlants of the World Online — Kew ScienceGermplasm Resources Information Network (GRIN)Ласкавецькн. VI : Літери Ком — Левиправивши або дописавши її